diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-10-28 20:52:14 +0200 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-11-01 02:22:05 +0100 |
commit | 9d4df9e0fadfc84cd826e0f7e946691b4d7baee5 (patch) | |
tree | dc1aebc200dfe6b6598167e569b157e2e04176f4 /drivers/net/tokenring/proteon.c | |
parent | [PATCH] ep93xx_eth: don't report RX errors (diff) | |
download | linux-9d4df9e0fadfc84cd826e0f7e946691b4d7baee5.tar.xz linux-9d4df9e0fadfc84cd826e0f7e946691b4d7baee5.zip |
[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/proteon.c')
-rw-r--r-- | drivers/net/tokenring/proteon.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c index 4f756960db2a..cb7dbb63c9d9 100644 --- a/drivers/net/tokenring/proteon.c +++ b/drivers/net/tokenring/proteon.c @@ -370,6 +370,10 @@ static int __init proteon_init(void) dev->dma = dma[i]; pdev = platform_device_register_simple("proteon", i, NULL, 0); + if (IS_ERR(pdev)) { + free_netdev(dev); + continue; + } err = setup_card(dev, &pdev->dev); if (!err) { proteon_dev[i] = pdev; @@ -385,9 +389,10 @@ static int __init proteon_init(void) /* Probe for cards. */ if (num == 0) { printk(KERN_NOTICE "proteon.c: No cards found.\n"); - return (-ENODEV); + platform_driver_unregister(&proteon_driver); + return -ENODEV; } - return (0); + return 0; } static void __exit proteon_cleanup(void) |