Commit 758a617c authored by Stephen Hemminger's avatar Stephen Hemminger

[PATCH] 2.5.70 - eepro100 - use alloc_etherdev

Ignore earlier patch -- this one locks and free's as appropriate.
Tested on 2.5.72 with SMP.

Of course, it begs the question why have two (now three) versions of drivers for
the same hardware...
parent 88695870
......@@ -116,6 +116,7 @@ static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>
#include <linux/skbuff.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
......@@ -670,7 +671,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
if (tx_ring_space == NULL)
return -1;
dev = init_etherdev(NULL, sizeof(struct speedo_private));
dev = alloc_etherdev(sizeof(struct speedo_private));
if (dev == NULL) {
printk(KERN_ERR "eepro100: Could not allocate ethernet device.\n");
pci_free_consistent(pdev, size, tx_ring_space, tx_ring_dma);
......@@ -687,6 +688,10 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
else
option = 0;
rtnl_lock();
if (dev_alloc_name(dev, dev->name) < 0)
goto err_free_unlock;
/* Read the station address EEPROM before doing the reset.
Nominally his should even be done before accepting the device, but
then we wouldn't have a device name with which to report the error.
......@@ -881,7 +886,16 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &speedo_ioctl;
if (register_netdevice(dev))
goto err_free_unlock;
rtnl_unlock();
return 0;
err_free_unlock:
rtnl_unlock();
kfree(dev);
return -1;
}
static void do_slow_command(struct net_device *dev, int cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment