diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-15 01:59:57 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-15 01:59:57 +0000 |
commit | 912fb93e1a9179ba486e1ca58b1422b85f1d792d (patch) | |
tree | 5e59cb0a680e663e7f63cbc0d4bc646ede21d57e /drivers | |
parent | 38950408e12ec8aa6e94dda61aedb56b9b283c3c (diff) |
IOC3 fixes from Hans Grober.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ioc3-eth.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 214bad2f5..c130ea402 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -865,9 +865,6 @@ ioc3_open(struct net_device *dev) ioc3_init(dev); netif_start_queue(dev); - - MOD_INC_USE_COUNT; - return 0; } @@ -883,9 +880,6 @@ ioc3_close(struct net_device *dev) free_irq(dev->irq, dev); ioc3_free_rings(ip); - - MOD_DEC_USE_COUNT; - return 0; } @@ -897,13 +891,14 @@ static int ioc3_pci_init(struct pci_dev *pdev) struct ioc3 *ioc3; unsigned long ioc3_base, ioc3_size; u32 vendor, model, rev; - int phy; + int phy, err; dev = init_etherdev(0, sizeof(struct ioc3_private)); if (!dev) return -ENOMEM; + SET_MODULE_OWNER(dev); ip = dev->priv; memset(ip, 0, sizeof(*ip)); @@ -919,6 +914,11 @@ static int ioc3_pci_init(struct pci_dev *pdev) ioc3_base = pdev->resource[0].start; ioc3_size = pdev->resource[0].end - ioc3_base; ioc3 = (struct ioc3 *) ioremap(ioc3_base, ioc3_size); + if (!ioc3) { + printk(KERN_CRIT"%s: Unable to map device I/O.\n", dev->name); + err = -ENOMEM; + goto out_free; + } ip->regs = ioc3; spin_lock_init(&ip->ioc3_lock); @@ -933,11 +933,8 @@ static int ioc3_pci_init(struct pci_dev *pdev) phy = ip->phy; if (phy == -1) { printk(KERN_CRIT"%s: Didn't find a PHY, goodbye.\n", dev->name); - ioc3_stop(dev); - free_irq(dev->irq, dev); - ioc3_free_rings(ip); - - return -ENODEV; + err = -ENODEV; + goto out_stop; } mii0 = mii_read(ioc3, phy, 0); @@ -970,11 +967,19 @@ static int ioc3_pci_init(struct pci_dev *pdev) dev->set_multicast_list = ioc3_set_multicast_list; return 0; + +out_stop: + ioc3_stop(dev); + free_irq(dev->irq, dev); + ioc3_free_rings(ip); +out_free: + kfree(dev); + return err; } static int __init ioc3_probe(void) { - static int called = 0; + static int called; int cards = 0; if (called) @@ -1195,10 +1200,8 @@ static void ioc3_set_multicast_list(struct net_device *dev) } } -#ifdef MODULE MODULE_AUTHOR("Ralf Baechle <ralf@oss.sgi.com>"); MODULE_DESCRIPTION("SGI IOC3 Ethernet driver"); -#endif /* MODULE */ module_init(ioc3_probe); module_exit(ioc3_cleanup_module); |