Commit 63edaf64 authored by Alexander Beregalov's avatar Alexander Beregalov Committed by David S. Miller

Au1x00: fix crash when trying register_netdev()

Andreas Lohre reported that the driver crashes when trying
to register_netdev(), he sugessted to move dev->netdev_ops initialization
before calling register_netdev(), it worked for him.
Reported-by: default avatarAndreas Lohre <alohre@gmail.com>
Signed-off-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5d09e534
...@@ -1088,7 +1088,14 @@ static struct net_device * au1000_probe(int port_num) ...@@ -1088,7 +1088,14 @@ static struct net_device * au1000_probe(int port_num)
return NULL; return NULL;
} }
if ((err = register_netdev(dev)) != 0) { dev->base_addr = base;
dev->irq = irq;
dev->netdev_ops = &au1000_netdev_ops;
SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
dev->watchdog_timeo = ETH_TX_TIMEOUT;
err = register_netdev(dev);
if (err != 0) {
printk(KERN_ERR "%s: Cannot register net device, error %d\n", printk(KERN_ERR "%s: Cannot register net device, error %d\n",
DRV_NAME, err); DRV_NAME, err);
free_netdev(dev); free_netdev(dev);
...@@ -1209,12 +1216,6 @@ static struct net_device * au1000_probe(int port_num) ...@@ -1209,12 +1216,6 @@ static struct net_device * au1000_probe(int port_num)
aup->tx_db_inuse[i] = pDB; aup->tx_db_inuse[i] = pDB;
} }
dev->base_addr = base;
dev->irq = irq;
dev->netdev_ops = &au1000_netdev_ops;
SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
dev->watchdog_timeo = ETH_TX_TIMEOUT;
/* /*
* The boot code uses the ethernet controller, so reset it to start * The boot code uses the ethernet controller, so reset it to start
* fresh. au1000_init() expects that the device is in reset state. * fresh. au1000_init() expects that the device is in reset state.
......
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