stmmac: fix oops on rmmod after assigning ip addr

An oops exists in the flow of stmmac_release().
phy_ethtool_get_wol() depends on phydev->drv.
phydev->drv will be null after stmmac_mdio_unreg() completes.

Steps to reproduce on Quark X1000:

1. ifconfig eth0 192.168.0.1
2. rmmod stmmac_pci

To fix this stmmac_mdio_unreg() should be run after unregister_netdev().

Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Reported-by: Dan O'Donovan <dan.odonovan@emutex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Bryan O'Donoghue 2015-04-16 17:56:03 +01:00 committed by David S. Miller
parent 31976cfdc7
commit e743471f8d

View File

@ -2970,15 +2970,15 @@ int stmmac_dvr_remove(struct net_device *ndev)
priv->hw->dma->stop_tx(priv->ioaddr); priv->hw->dma->stop_tx(priv->ioaddr);
stmmac_set_mac(priv->ioaddr, false); stmmac_set_mac(priv->ioaddr, false);
if (priv->pcs != STMMAC_PCS_RGMII && priv->pcs != STMMAC_PCS_TBI &&
priv->pcs != STMMAC_PCS_RTBI)
stmmac_mdio_unregister(ndev);
netif_carrier_off(ndev); netif_carrier_off(ndev);
unregister_netdev(ndev); unregister_netdev(ndev);
if (priv->stmmac_rst) if (priv->stmmac_rst)
reset_control_assert(priv->stmmac_rst); reset_control_assert(priv->stmmac_rst);
clk_disable_unprepare(priv->pclk); clk_disable_unprepare(priv->pclk);
clk_disable_unprepare(priv->stmmac_clk); clk_disable_unprepare(priv->stmmac_clk);
if (priv->pcs != STMMAC_PCS_RGMII && priv->pcs != STMMAC_PCS_TBI &&
priv->pcs != STMMAC_PCS_RTBI)
stmmac_mdio_unregister(ndev);
free_netdev(ndev); free_netdev(ndev);
return 0; return 0;