net: phy: Avoid NPD upon phy_detach() when driver is unbound
[linux-2.6-microblaze.git] / drivers / net / phy / phy_device.c
index b93b40c..5dab6be 100644 (file)
@@ -1682,7 +1682,8 @@ void phy_detach(struct phy_device *phydev)
 
        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