diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 83e52f1b80f2..aeaf1bcb12d0 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -981,6 +981,8 @@ void phy_detach(struct phy_device *phydev) phydev->attached_dev = NULL; phy_suspend(phydev); + phy_led_triggers_unregister(phydev); + /* If the device had no specific driver before (i.e. - it * was using the generic driver), we unbind the device * from the generic driver so that there's a chance a @@ -994,8 +996,6 @@ void phy_detach(struct phy_device *phydev) } } - phy_led_triggers_unregister(phydev); - /* * The phydev might go away on the put_device() below, so avoid * a use-after-free bug by reading the underlying bus first.