diff options
author | <herbert@gondor.apana.org.au> | 2005-05-12 20:11:55 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-05-12 20:11:55 -0400 |
commit | b1fc5505e0dbcc3fd7c75bfe6bee39ec50080963 (patch) | |
tree | f8c0bb679dc8e72816e16820c3dbcccf924097eb /drivers/net/3c515.c | |
parent | 88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff) |
[netdrvr] Fix register_netdev() races in older ISA net drivers
Diffstat (limited to 'drivers/net/3c515.c')
-rw-r--r-- | drivers/net/3c515.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index c4cf4fcd1344..d272ea36a578 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -365,7 +365,7 @@ static int nopnp; | |||
365 | #endif /* __ISAPNP__ */ | 365 | #endif /* __ISAPNP__ */ |
366 | 366 | ||
367 | static struct net_device *corkscrew_scan(int unit); | 367 | static struct net_device *corkscrew_scan(int unit); |
368 | static void corkscrew_setup(struct net_device *dev, int ioaddr, | 368 | static int corkscrew_setup(struct net_device *dev, int ioaddr, |
369 | struct pnp_dev *idev, int card_number); | 369 | struct pnp_dev *idev, int card_number); |
370 | static int corkscrew_open(struct net_device *dev); | 370 | static int corkscrew_open(struct net_device *dev); |
371 | static void corkscrew_timer(unsigned long arg); | 371 | static void corkscrew_timer(unsigned long arg); |
@@ -539,10 +539,9 @@ static struct net_device *corkscrew_scan(int unit) | |||
539 | printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n", | 539 | printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n", |
540 | inl(ioaddr + 0x2002), inw(ioaddr + 0x2000)); | 540 | inl(ioaddr + 0x2002), inw(ioaddr + 0x2000)); |
541 | /* irq = inw(ioaddr + 0x2002) & 15; */ /* Use the irq from isapnp */ | 541 | /* irq = inw(ioaddr + 0x2002) & 15; */ /* Use the irq from isapnp */ |
542 | corkscrew_setup(dev, ioaddr, idev, cards_found++); | ||
543 | SET_NETDEV_DEV(dev, &idev->dev); | 542 | SET_NETDEV_DEV(dev, &idev->dev); |
544 | pnp_cards++; | 543 | pnp_cards++; |
545 | err = register_netdev(dev); | 544 | err = corkscrew_setup(dev, ioaddr, idev, cards_found++); |
546 | if (!err) | 545 | if (!err) |
547 | return dev; | 546 | return dev; |
548 | cleanup_card(dev); | 547 | cleanup_card(dev); |
@@ -558,8 +557,7 @@ no_pnp: | |||
558 | 557 | ||
559 | printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n", | 558 | printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n", |
560 | inl(ioaddr + 0x2002), inw(ioaddr + 0x2000)); | 559 | inl(ioaddr + 0x2002), inw(ioaddr + 0x2000)); |
561 | corkscrew_setup(dev, ioaddr, NULL, cards_found++); | 560 | err = corkscrew_setup(dev, ioaddr, NULL, cards_found++); |
562 | err = register_netdev(dev); | ||
563 | if (!err) | 561 | if (!err) |
564 | return dev; | 562 | return dev; |
565 | cleanup_card(dev); | 563 | cleanup_card(dev); |
@@ -568,7 +566,7 @@ no_pnp: | |||
568 | return NULL; | 566 | return NULL; |
569 | } | 567 | } |
570 | 568 | ||
571 | static void corkscrew_setup(struct net_device *dev, int ioaddr, | 569 | static int corkscrew_setup(struct net_device *dev, int ioaddr, |
572 | struct pnp_dev *idev, int card_number) | 570 | struct pnp_dev *idev, int card_number) |
573 | { | 571 | { |
574 | struct corkscrew_private *vp = netdev_priv(dev); | 572 | struct corkscrew_private *vp = netdev_priv(dev); |
@@ -691,6 +689,8 @@ static void corkscrew_setup(struct net_device *dev, int ioaddr, | |||
691 | dev->get_stats = &corkscrew_get_stats; | 689 | dev->get_stats = &corkscrew_get_stats; |
692 | dev->set_multicast_list = &set_rx_mode; | 690 | dev->set_multicast_list = &set_rx_mode; |
693 | dev->ethtool_ops = &netdev_ethtool_ops; | 691 | dev->ethtool_ops = &netdev_ethtool_ops; |
692 | |||
693 | return register_netdev(dev); | ||
694 | } | 694 | } |
695 | 695 | ||
696 | 696 | ||