|
@@ -920,6 +920,11 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
|
+ if (!try_module_get(d->driver->owner)) {
|
|
|
+ dev_err(&dev->dev, "failed to get the device driver module\n");
|
|
|
+ return -EIO;
|
|
|
+ }
|
|
|
+
|
|
|
get_device(d);
|
|
|
|
|
|
/* Assume that if there is no driver, that it doesn't
|
|
@@ -977,6 +982,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
|
|
error:
|
|
|
phy_detach(phydev);
|
|
|
put_device(d);
|
|
|
+ module_put(d->driver->owner);
|
|
|
if (ndev_owner != bus->owner)
|
|
|
module_put(bus->owner);
|
|
|
return err;
|
|
@@ -1059,6 +1065,7 @@ void phy_detach(struct phy_device *phydev)
|
|
|
bus = phydev->mdio.bus;
|
|
|
|
|
|
put_device(&phydev->mdio.dev);
|
|
|
+ module_put(phydev->mdio.dev.driver->owner);
|
|
|
if (ndev_owner != bus->owner)
|
|
|
module_put(bus->owner);
|
|
|
}
|