aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/3com
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2013-06-09 16:16:52 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-12 04:53:52 -0400
commitafd6eae13cc4229e25d59334cdc46d042b24a4a5 (patch)
tree6f373c9d15d81022085d156a80aab775300c163a /drivers/net/ethernet/3com
parent3f8b96379a820318db37f7b6e81e6e459ad56efe (diff)
3c59x: consolidate error cleanup in vortex_init_one()
The PCI driver's probe() method duplicates the error cleanup code each time it has to do error exit. Consolidate the error cleanup code in one place and use *goto* to jump to the right places. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Steffen Klassert <klassert@mathematik.tu-chemnitz.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/3com')
-rw-r--r--drivers/net/ethernet/3com/3c59x.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 30e74211a755..ad5272b348f0 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -1012,10 +1012,8 @@ static int vortex_init_one(struct pci_dev *pdev,
1012 goto out; 1012 goto out;
1013 1013
1014 rc = pci_request_regions(pdev, DRV_NAME); 1014 rc = pci_request_regions(pdev, DRV_NAME);
1015 if (rc < 0) { 1015 if (rc < 0)
1016 pci_disable_device(pdev); 1016 goto out_disable;
1017 goto out;
1018 }
1019 1017
1020 unit = vortex_cards_found; 1018 unit = vortex_cards_found;
1021 1019
@@ -1032,23 +1030,24 @@ static int vortex_init_one(struct pci_dev *pdev,
1032 if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */ 1030 if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */
1033 ioaddr = pci_iomap(pdev, 0, 0); 1031 ioaddr = pci_iomap(pdev, 0, 0);
1034 if (!ioaddr) { 1032 if (!ioaddr) {
1035 pci_release_regions(pdev);
1036 pci_disable_device(pdev);
1037 rc = -ENOMEM; 1033 rc = -ENOMEM;
1038 goto out; 1034 goto out_release;
1039 } 1035 }
1040 1036
1041 rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq, 1037 rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq,
1042 ent->driver_data, unit); 1038 ent->driver_data, unit);
1043 if (rc < 0) { 1039 if (rc < 0)
1044 pci_iounmap(pdev, ioaddr); 1040 goto out_iounmap;
1045 pci_release_regions(pdev);
1046 pci_disable_device(pdev);
1047 goto out;
1048 }
1049 1041
1050 vortex_cards_found++; 1042 vortex_cards_found++;
1043 goto out;
1051 1044
1045out_iounmap:
1046 pci_iounmap(pdev, ioaddr);
1047out_release:
1048 pci_release_regions(pdev);
1049out_disable:
1050 pci_disable_device(pdev);
1052out: 1051out:
1053 return rc; 1052 return rc;
1054} 1053}