summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-06-05 20:31:29 +0000
committerDavid S. Miller <davem@davemloft.net>2012-06-07 13:15:09 -0700
commitc3001b773bb63afd403bae37febf3f09826912cb (patch)
tree575e8c9f53d88ec6ad465f4b0d23fe67e76fa7dc
parent69927fccd96b15bd228bb82d356a7a2a0cfaeefb (diff)
net/ethernet: ks8851_mll unregister_netdev() before freeing
We added another error condition here, but if we were to hit it then we need to unregister_netdev() before doing the free_netdev(). Otherwise we would hit the BUG_ON() in free_netdev(): BUG_ON(dev->reg_state != NETREG_UNREGISTERED); Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Tested-by: Raffaele Recalcati <raffaele.recalcati@bticino.it> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 70bd329882c..875dd5e264e 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1606,7 +1606,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
if (!pdata) {
netdev_err(netdev, "No platform data\n");
err = -ENODEV;
- goto err_register;
+ goto err_pdata;
}
memcpy(ks->mac_addr, pdata->mac_addr, 6);
if (!is_valid_ether_addr(ks->mac_addr)) {
@@ -1626,6 +1626,8 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
(id >> 8) & 0xff, (id >> 4) & 0xf, (id >> 1) & 0x7);
return 0;
+err_pdata:
+ unregister_netdev(netdev);
err_register:
err_get_irq:
iounmap(ks->hw_addr_cmd);