diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-10-28 14:52:14 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-10-31 20:22:05 -0500 |
commit | 9d4df9e0fadfc84cd826e0f7e946691b4d7baee5 (patch) | |
tree | dc1aebc200dfe6b6598167e569b157e2e04176f4 /drivers/net/tokenring/skisa.c | |
parent | 06f0015ace46ce9d313ec02d6b13c47c8e795a6c (diff) |
[PATCH] tokenring: fix module_init error handling
- Call platform_driver_unregister() before return when no cards found.
(fixes data corruption when no cards found)
- Check platform_device_register_simple() return value
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Mike Phillips <mikep@linuxtr.net>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
drivers/net/tokenring/proteon.c | 9 +++++++--
drivers/net/tokenring/skisa.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/tokenring/skisa.c')
-rw-r--r-- | drivers/net/tokenring/skisa.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c index d6ba41cf3110..33afea31d87b 100644 --- a/drivers/net/tokenring/skisa.c +++ b/drivers/net/tokenring/skisa.c | |||
@@ -380,6 +380,10 @@ static int __init sk_isa_init(void) | |||
380 | dev->dma = dma[i]; | 380 | dev->dma = dma[i]; |
381 | pdev = platform_device_register_simple("skisa", | 381 | pdev = platform_device_register_simple("skisa", |
382 | i, NULL, 0); | 382 | i, NULL, 0); |
383 | if (IS_ERR(pdev)) { | ||
384 | free_netdev(dev); | ||
385 | continue; | ||
386 | } | ||
383 | err = setup_card(dev, &pdev->dev); | 387 | err = setup_card(dev, &pdev->dev); |
384 | if (!err) { | 388 | if (!err) { |
385 | sk_isa_dev[i] = pdev; | 389 | sk_isa_dev[i] = pdev; |
@@ -395,9 +399,10 @@ static int __init sk_isa_init(void) | |||
395 | /* Probe for cards. */ | 399 | /* Probe for cards. */ |
396 | if (num == 0) { | 400 | if (num == 0) { |
397 | printk(KERN_NOTICE "skisa.c: No cards found.\n"); | 401 | printk(KERN_NOTICE "skisa.c: No cards found.\n"); |
398 | return (-ENODEV); | 402 | platform_driver_unregister(&sk_isa_driver); |
403 | return -ENODEV; | ||
399 | } | 404 | } |
400 | return (0); | 405 | return 0; |
401 | } | 406 | } |
402 | 407 | ||
403 | static void __exit sk_isa_cleanup(void) | 408 | static void __exit sk_isa_cleanup(void) |