Skip to content

Commit

Permalink
net: ethernet: fix kernel OOPS when remove davinci_mdio module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bin Liu authored and David S. Miller committed Aug 31, 2012
1 parent 599901c commit b27393a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/ti/davinci_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b27393a

Please sign in to comment.