Commit aee04f4b authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

net: stmmac: remove unnecessary netif_carrier_off()

It is incorrect to call netif_carrier_off(), or in fact any driver
teardown, before unregister_netdev() has been called.

unregister_netdev() unpublishes the network device from userspace, and
takes the interface down if it was up prior to returning. Therefore,
once the call has returned, we are guaranteed that .ndo_stop() will
have been called for an interface that was up. Phylink will take the
carrier down via phylink_stop(), making any manipulation of the carrier
in the remove path unnecessary.

In the stmmac_release() path, the netif_carrier_off() call follows the
call to phylink_stop(), so this call is redundant.
Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/E1sCErZ-00EOPx-PF@rmk-PC.armlinux.org.ukSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3277407e
...@@ -4088,8 +4088,6 @@ static int stmmac_release(struct net_device *dev) ...@@ -4088,8 +4088,6 @@ static int stmmac_release(struct net_device *dev)
if (priv->plat->serdes_powerdown) if (priv->plat->serdes_powerdown)
priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv); priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv);
netif_carrier_off(dev);
stmmac_release_ptp(priv); stmmac_release_ptp(priv);
pm_runtime_put(priv->device); pm_runtime_put(priv->device);
...@@ -7806,7 +7804,6 @@ void stmmac_dvr_remove(struct device *dev) ...@@ -7806,7 +7804,6 @@ void stmmac_dvr_remove(struct device *dev)
stmmac_stop_all_dma(priv); stmmac_stop_all_dma(priv);
stmmac_mac_set(priv, priv->ioaddr, false); stmmac_mac_set(priv, priv->ioaddr, false);
netif_carrier_off(ndev);
unregister_netdev(ndev); unregister_netdev(ndev);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment