aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-05-23 16:58:12 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-23 23:14:14 -0400
commitae2d990eede0ef5938c210d48a177c044258ecd8 (patch)
tree7b4647fee2ef54f65583b1daaf406a88935b58ff /drivers/isdn/hisax
parent9d9a2000e683ecd497b65d5f3e73b048c68976e1 (diff)
HiSax: fix error checking for hisax_register()]
This patch (as875) adds error-checking to the callers of hisax_register(). It also changes an error pathway in that routine, making it return an error code rather than 0. This fixes Bugzilla #7960. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Karsten Keil <kkeil@suse.de> Cc: Martin Bachem <info@colognechip.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn/hisax')
-rw-r--r--drivers/isdn/hisax/config.c2
-rw-r--r--drivers/isdn/hisax/hfc_usb.c43
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c6
-rw-r--r--drivers/isdn/hisax/st5481_init.c7
-rw-r--r--drivers/isdn/hisax/st5481_usb.c1
5 files changed, 30 insertions, 29 deletions
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index da4196f21e0f..8d53a7fd2671 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1551,7 +1551,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
1551 if (retval == 0) { // yuck 1551 if (retval == 0) { // yuck
1552 cards[i].typ = 0; 1552 cards[i].typ = 0;
1553 nrcards--; 1553 nrcards--;
1554 return retval; 1554 return -EINVAL;
1555 } 1555 }
1556 cs = cards[i].cs; 1556 cs = cards[i].cs;
1557 hisax_d_if->cs = cs; 1557 hisax_d_if->cs = cs;
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index 1f18f1993387..b1a26e02df02 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -485,7 +485,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe,
485{ 485{
486 int k; 486 int k;
487 487
488 spin_lock_init(&urb->lock);
489 urb->dev = dev; 488 urb->dev = dev;
490 urb->pipe = pipe; 489 urb->pipe = pipe;
491 urb->complete = complete; 490 urb->complete = complete;
@@ -578,16 +577,14 @@ stop_isoc_chain(usb_fifo * fifo)
578 "HFC-S USB: Stopping iso chain for fifo %i.%i", 577 "HFC-S USB: Stopping iso chain for fifo %i.%i",
579 fifo->fifonum, i); 578 fifo->fifonum, i);
580#endif 579#endif
581 usb_unlink_urb(fifo->iso[i].purb); 580 usb_kill_urb(fifo->iso[i].purb);
582 usb_free_urb(fifo->iso[i].purb); 581 usb_free_urb(fifo->iso[i].purb);
583 fifo->iso[i].purb = NULL; 582 fifo->iso[i].purb = NULL;
584 } 583 }
585 } 584 }
586 if (fifo->urb) { 585 usb_kill_urb(fifo->urb);
587 usb_unlink_urb(fifo->urb); 586 usb_free_urb(fifo->urb);
588 usb_free_urb(fifo->urb); 587 fifo->urb = NULL;
589 fifo->urb = NULL;
590 }
591 fifo->active = 0; 588 fifo->active = 0;
592} 589}
593 590
@@ -1305,7 +1302,11 @@ usb_init(hfcusb_data * hfc)
1305 } 1302 }
1306 /* default Prot: EURO ISDN, should be a module_param */ 1303 /* default Prot: EURO ISDN, should be a module_param */
1307 hfc->protocol = 2; 1304 hfc->protocol = 2;
1308 hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); 1305 i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol);
1306 if (i) {
1307 printk(KERN_INFO "HFC-S USB: hisax_register -> %d\n", i);
1308 return i;
1309 }
1309 1310
1310#ifdef CONFIG_HISAX_DEBUG 1311#ifdef CONFIG_HISAX_DEBUG
1311 hfc_debug = debug; 1312 hfc_debug = debug;
@@ -1626,11 +1627,9 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1626#endif 1627#endif
1627 /* init the chip and register the driver */ 1628 /* init the chip and register the driver */
1628 if (usb_init(context)) { 1629 if (usb_init(context)) {
1629 if (context->ctrl_urb) { 1630 usb_kill_urb(context->ctrl_urb);
1630 usb_unlink_urb(context->ctrl_urb); 1631 usb_free_urb(context->ctrl_urb);
1631 usb_free_urb(context->ctrl_urb); 1632 context->ctrl_urb = NULL;
1632 context->ctrl_urb = NULL;
1633 }
1634 kfree(context); 1633 kfree(context);
1635 return (-EIO); 1634 return (-EIO);
1636 } 1635 }
@@ -1682,21 +1681,15 @@ hfc_usb_disconnect(struct usb_interface
1682 i); 1681 i);
1683#endif 1682#endif
1684 } 1683 }
1685 if (context->fifos[i].urb) { 1684 usb_kill_urb(context->fifos[i].urb);
1686 usb_unlink_urb(context->fifos[i].urb); 1685 usb_free_urb(context->fifos[i].urb);
1687 usb_free_urb(context->fifos[i].urb); 1686 context->fifos[i].urb = NULL;
1688 context->fifos[i].urb = NULL;
1689 }
1690 } 1687 }
1691 context->fifos[i].active = 0; 1688 context->fifos[i].active = 0;
1692 } 1689 }
1693 /* wait for all URBS to terminate */ 1690 usb_kill_urb(context->ctrl_urb);
1694 mdelay(10); 1691 usb_free_urb(context->ctrl_urb);
1695 if (context->ctrl_urb) { 1692 context->ctrl_urb = NULL;
1696 usb_unlink_urb(context->ctrl_urb);
1697 usb_free_urb(context->ctrl_urb);
1698 context->ctrl_urb = NULL;
1699 }
1700 hisax_unregister(&context->d_if); 1693 hisax_unregister(&context->d_if);
1701 kfree(context); /* free our structure again */ 1694 kfree(context); /* free our structure again */
1702} /* hfc_usb_disconnect */ 1695} /* hfc_usb_disconnect */
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index 9e088fce8c3a..7993e01f9fc5 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -859,7 +859,11 @@ new_adapter(void)
859 for (i = 0; i < 2; i++) 859 for (i = 0; i < 2; i++)
860 b_if[i] = &adapter->bcs[i].b_if; 860 b_if[i] = &adapter->bcs[i].b_if;
861 861
862 hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp", protocol); 862 if (hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp",
863 protocol) != 0) {
864 kfree(adapter);
865 adapter = NULL;
866 }
863 867
864 return adapter; 868 return adapter;
865} 869}
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c
index bb3a28a53ff4..13751237bfcd 100644
--- a/drivers/isdn/hisax/st5481_init.c
+++ b/drivers/isdn/hisax/st5481_init.c
@@ -107,12 +107,17 @@ static int probe_st5481(struct usb_interface *intf,
107 for (i = 0; i < 2; i++) 107 for (i = 0; i < 2; i++)
108 b_if[i] = &adapter->bcs[i].b_if; 108 b_if[i] = &adapter->bcs[i].b_if;
109 109
110 hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", protocol); 110 if (hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb",
111 protocol) != 0)
112 goto err_b1;
113
111 st5481_start(adapter); 114 st5481_start(adapter);
112 115
113 usb_set_intfdata(intf, adapter); 116 usb_set_intfdata(intf, adapter);
114 return 0; 117 return 0;
115 118
119 err_b1:
120 st5481_release_b(&adapter->bcs[1]);
116 err_b: 121 err_b:
117 st5481_release_b(&adapter->bcs[0]); 122 st5481_release_b(&adapter->bcs[0]);
118 err_d: 123 err_d:
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
index ff1595122048..4ada66b8b679 100644
--- a/drivers/isdn/hisax/st5481_usb.c
+++ b/drivers/isdn/hisax/st5481_usb.c
@@ -407,7 +407,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev,
407{ 407{
408 int k; 408 int k;
409 409
410 spin_lock_init(&urb->lock);
411 urb->dev=dev; 410 urb->dev=dev;
412 urb->pipe=pipe; 411 urb->pipe=pipe;
413 urb->interval = 1; 412 urb->interval = 1;