[PATCH 8/8] bcm63xx: fix oops when removing bcm63xx_enet module.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SET_NETDEV_DEV has to be called before registering netdevice, not
after, otherwise we get unbalanced kobject get/put when unregistering.

This patch also adds missing platform_set_drvdata(pdev, NULL) before
freiing netdevice.

Signed-off-by: Maxime Bizon <mbizon@xxxxxxxxxx>
---
 drivers/net/bcm63xx_enet.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
index 660ffa2..09d2709 100644
--- a/drivers/net/bcm63xx_enet.c
+++ b/drivers/net/bcm63xx_enet.c
@@ -1788,6 +1788,7 @@ static int __devinit bcm_enet_probe(struct platform_device *pdev)
 	netif_napi_add(dev, &priv->napi, bcm_enet_poll, 16);
 
 	SET_ETHTOOL_OPS(dev, &bcm_enet_ethtool_ops);
+	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	ret = register_netdev(dev);
 	if (ret)
@@ -1797,7 +1798,6 @@ static int __devinit bcm_enet_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, dev);
 	priv->pdev = pdev;
 	priv->net_dev = dev;
-	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	return 0;
 
@@ -1877,6 +1877,7 @@ static int __devexit bcm_enet_remove(struct platform_device *pdev)
 	clk_disable(priv->mac_clk);
 	clk_put(priv->mac_clk);
 
+	platform_set_drvdata(pdev, NULL);
 	free_netdev(dev);
 	return 0;
 }
-- 
1.6.0.4



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux