summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wct4xxp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-01-17 17:17:44 +0000
committerShaun Ruffell <sruffell@digium.com>2011-01-17 17:17:44 +0000
commit44af1e96c318087c0b459779c2b5be3d9b99d534 (patch)
treea7f7e034caaaf20e3b8af9c11bb5b3f9ed617bf0 /drivers/dahdi/wct4xxp
parent4b08c12f2662dd32c8c04383a056ca878654aac7 (diff)
wct4xxp: Check the return value of dahdi_register call.
If dahdi_register fails, we would like the error to propagate to the user who ran modprobe. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9636 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wct4xxp')
-rw-r--r--drivers/dahdi/wct4xxp/base.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c
index 15397e8..acfa3a7 100644
--- a/drivers/dahdi/wct4xxp/base.c
+++ b/drivers/dahdi/wct4xxp/base.c
@@ -4882,17 +4882,12 @@ static int t4_hardware_stop(struct t4 *wc)
return 0;
}
-static void __devexit t4_remove_one(struct pci_dev *pdev)
+static void __devexit _t4_remove_one(struct t4 *wc)
{
- struct t4 *wc = pci_get_drvdata(pdev);
struct dahdi_span *span;
int basesize;
int i;
- if (!wc) {
- return;
- }
-
remove_sysfs_files(wc);
/* Stop hardware */
@@ -4920,24 +4915,33 @@ static void __devexit t4_remove_one(struct pci_dev *pdev)
}
#endif
- free_irq(pdev->irq, wc);
+ free_irq(wc->dev->irq, wc);
if (wc->membase)
iounmap(wc->membase);
- pci_release_regions(pdev);
+ pci_release_regions(wc->dev);
/* Immediately free resources */
- pci_free_consistent(pdev, T4_BASE_SIZE * wc->numbufs * 2,
+ pci_free_consistent(wc->dev, T4_BASE_SIZE * wc->numbufs * 2,
wc->writechunk, wc->writedma);
order_index[wc->order]--;
cards[wc->num] = NULL;
- pci_set_drvdata(pdev, NULL);
+ pci_set_drvdata(wc->dev, NULL);
free_wc(wc);
}
+static void __devexit t4_remove_one(struct pci_dev *pdev)
+{
+ struct t4 *wc = pci_get_drvdata(pdev);
+ if (!wc)
+ return;
+
+ _t4_remove_one(wc);
+}
+
static DEFINE_PCI_DEVICE_TABLE(t4_pci_tbl) =
{
@@ -4976,6 +4980,7 @@ static struct pci_driver t4_driver = {
static int __init t4_init(void)
{
+ int i;
int res;
res = dahdi_pci_module(&t4_driver);
if (res)
@@ -4986,17 +4991,23 @@ static int __init t4_init(void)
printk(KERN_NOTICE "wct4xxp: Ident of first card is not zero (%d)\n",
cards[0]->order);
}
- for (res = 0; cards[res]; res++) {
+ for (i = 0; cards[i]; i++) {
/* warn the user of duplicate ident values it is probably
* unintended */
- if (debug && res < 15 && cards[res+1] &&
- cards[res]->order == cards[res+1]->order) {
+ if (debug && res < 15 && cards[i+1] &&
+ cards[res]->order == cards[i+1]->order) {
printk(KERN_NOTICE "wct4xxp: Duplicate ident value found (%d)\n",
- cards[res]->order);
+ cards[i]->order);
+ }
+ res = t4_launch(cards[i]);
+ if (res) {
+ int j;
+ for (j = 0; j < i; ++j)
+ _t4_remove_one(cards[j]);
+ break;
}
- t4_launch(cards[res]);
}
- return 0;
+ return res;
}
static void __exit t4_cleanup(void)