diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-05-29 14:47:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-30 17:52:16 -0400 |
commit | 2e1d4a065a77d076a679df22a4eddbc7e33cad98 (patch) | |
tree | cdb5d79a42fa471f94f8fb5c45db6a40cdac1561 /drivers/net/ethernet/smsc | |
parent | 3bbf372c6c60255585783bb08ab477a72b918196 (diff) |
net/smsc911x: Repair broken failure paths
Current failure paths attempt to free resources which we failed to request
and disable resources which we failed to enable ones. This leads to kernel
oops/panic. This patch does some simple re-ordering to prevent this from
happening.
Cc: netdev@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/smsc')
-rw-r--r-- | drivers/net/ethernet/smsc/smsc911x.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index dab9c6f671ec..1466e5d2af44 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -2390,11 +2390,11 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
2390 | 2390 | ||
2391 | retval = smsc911x_request_resources(pdev); | 2391 | retval = smsc911x_request_resources(pdev); |
2392 | if (retval) | 2392 | if (retval) |
2393 | goto out_return_resources; | 2393 | goto out_request_resources_fail; |
2394 | 2394 | ||
2395 | retval = smsc911x_enable_resources(pdev); | 2395 | retval = smsc911x_enable_resources(pdev); |
2396 | if (retval) | 2396 | if (retval) |
2397 | goto out_disable_resources; | 2397 | goto out_enable_resources_fail; |
2398 | 2398 | ||
2399 | if (pdata->ioaddr == NULL) { | 2399 | if (pdata->ioaddr == NULL) { |
2400 | SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); | 2400 | SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); |
@@ -2501,8 +2501,9 @@ out_free_irq: | |||
2501 | free_irq(dev->irq, dev); | 2501 | free_irq(dev->irq, dev); |
2502 | out_disable_resources: | 2502 | out_disable_resources: |
2503 | (void)smsc911x_disable_resources(pdev); | 2503 | (void)smsc911x_disable_resources(pdev); |
2504 | out_return_resources: | 2504 | out_enable_resources_fail: |
2505 | smsc911x_free_resources(pdev); | 2505 | smsc911x_free_resources(pdev); |
2506 | out_request_resources_fail: | ||
2506 | platform_set_drvdata(pdev, NULL); | 2507 | platform_set_drvdata(pdev, NULL); |
2507 | iounmap(pdata->ioaddr); | 2508 | iounmap(pdata->ioaddr); |
2508 | free_netdev(dev); | 2509 | free_netdev(dev); |