net: emaclite: Fix MDIO bus unregister bug
authorRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Wed, 13 Jun 2018 06:35:17 +0000 (12:05 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Jun 2018 00:08:03 +0000 (17:08 -0700)
Since 'has_mdio' flag is not used,sequence insmod->rmmod-> insmod
leads to failure as MDIO unregister doesn't happen in .remove().
Fix it by checking MII bus pointer instead.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/xilinx_emaclite.c

index 37989ce543ba5ddc890508367eed7f943820e01e..06eb6c8863882f9b76c4998307359bb782ba901a 100644 (file)
@@ -1191,7 +1191,7 @@ static int xemaclite_of_remove(struct platform_device *of_dev)
        struct net_local *lp = netdev_priv(ndev);
 
        /* Un-register the mii_bus, if configured */
-       if (lp->has_mdio) {
+       if (lp->mii_bus) {
                mdiobus_unregister(lp->mii_bus);
                mdiobus_free(lp->mii_bus);
                lp->mii_bus = NULL;