net: ethernet: fix kernel OOPS when remove davinci_mdio module
authorBin Liu <b-liu@ti.com>
Thu, 30 Aug 2012 06:37:32 +0000 (06:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Aug 2012 20:35:07 +0000 (16:35 -0400)
davinci mdio device is not unregistered from mdiobus when removing
the module, which causes BUG_ON() when free the device from mdiobus.

Calling mdiobus_unregister() before mdiobus_free() fixes the issue.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/davinci_mdio.c

index cd7ee20..a9ca4a0 100644 (file)
@@ -394,8 +394,10 @@ static int __devexit davinci_mdio_remove(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct davinci_mdio_data *data = dev_get_drvdata(dev);
 
-       if (data->bus)
+       if (data->bus) {
+               mdiobus_unregister(data->bus);
                mdiobus_free(data->bus);
+       }
 
        if (data->clk)
                clk_put(data->clk);