From: Arun Iyengar stmmac_dvr_remove() asserts the MAC resets before it unregisters the MDIO bus, so the PHYs on the bus are removed with the MDIO master in reset. The probe error path does not assert them at all. Assert them after the PCS and the MDIO bus are gone in both. Signed-off-by: Arun Iyengar --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1280496741e7..da03a8223bba 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -8406,6 +8406,9 @@ static int __stmmac_dvr_probe(struct device *device, pm_runtime_put_noidle(device); stmmac_napi_del(ndev); error_hw_init: + if (priv->plat->stmmac_rst) + reset_control_assert(priv->plat->stmmac_rst); + reset_control_assert(priv->plat->stmmac_ahb_rst); destroy_workqueue(priv->wq); error_wq_init: bitmap_free(priv->af_xdp_zc_qps); @@ -8465,13 +8468,13 @@ void stmmac_dvr_remove(struct device *dev) stmmac_unregister_devlink(priv); phylink_destroy(priv->phylink); + stmmac_pcs_clean(ndev); + stmmac_mdio_unregister(ndev); + if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst); reset_control_assert(priv->plat->stmmac_ahb_rst); - stmmac_pcs_clean(ndev); - stmmac_mdio_unregister(ndev); - destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); mutex_destroy(&priv->est_lock); -- 2.55.0