[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOMZO5CjRbvPJjNDGkOFjz+AZ1ydN9+SRBsypCPyNocPoFOdRA@mail.gmail.com>
Date: Wed, 8 Feb 2017 12:47:47 -0200
From: Fabio Estevam <festevam@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Florian Fainelli <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: Kernel crashes in phy_attach_direct()
On Wed, Feb 8, 2017 at 12:40 PM, Andrew Lunn <andrew@...n.ch> wrote:
> And i guess you don't have a specific PHY driver for you PHYs. You are
> using the generic PHY driver?
Yes, I am:
Generic PHY 63fec000.ethernet-1:00: attached PHY driver [Generic PHY]
(mii_bus:phy_addr=63fec000.ethernet-1:00, irq=-1)
>
> Could you try modifying phy_attach_direct() such that the
> try_module_get() is after:
>
> /* Assume that if there is no driver, that it doesn't
> * exist, and we should use the genphy driver.
> */
> if (!d->driver) {
> <snip>
> }
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?
Thanks
Powered by blists - more mailing lists