Message ID | CAOMZO5CjRbvPJjNDGkOFjz+AZ1ydN9+SRBsypCPyNocPoFOdRA@mail.gmail.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
> Yes, this is what I am using right now: > > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -920,11 +920,6 @@ 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 > @@ -946,6 +941,11 @@ int phy_attach_direct(struct net_device *dev, > struct phy_device *phydev, > goto error; > } > > + if (!try_module_get(d->driver->owner)) { > + dev_err(&dev->dev, "failed to get the device driver module\n"); > + return -EIO; > + } > + > if (phydev->attached_dev) { > dev_err(&dev->dev, "PHY already attached\n"); > err = -EBUSY; > > Would you like me to submit this one? I'm just wondering about the get_device(d); Does the ordering matter here? Lets wait for Florian before submitting a patch. Andrew
On 02/08/2017 06:51 AM, Andrew Lunn wrote: >> Yes, this is what I am using right now: >> >> --- a/drivers/net/phy/phy_device.c >> +++ b/drivers/net/phy/phy_device.c >> @@ -920,11 +920,6 @@ 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 >> @@ -946,6 +941,11 @@ int phy_attach_direct(struct net_device *dev, >> struct phy_device *phydev, >> goto error; >> } >> >> + if (!try_module_get(d->driver->owner)) { >> + dev_err(&dev->dev, "failed to get the device driver module\n"); >> + return -EIO; >> + } >> + >> if (phydev->attached_dev) { >> dev_err(&dev->dev, "PHY already attached\n"); >> err = -EBUSY; >> >> Would you like me to submit this one? > > I'm just wondering about the get_device(d); Does the ordering matter > here? Lets wait for Florian before submitting a patch. I sent a fix for that last night: https://patchwork.ozlabs.org/patch/725522/ Sorry about that!
--- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -920,11 +920,6 @@ 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);