--- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1631,7 +1631,8 @@ void phy_detach(struct phy_device *phyde phy_led_triggers_unregister(phydev); - module_put(phydev->mdio.dev.driver->owner); + if (phydev->mdio.dev.driver) + module_put(phydev->mdio.dev.driver->owner); /* If the device had no specific driver before (i.e. - it * was using the generic driver), we unbind the device