[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170208145148.GF10855@lunn.ch>
Date: Wed, 8 Feb 2017 15:51:48 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Fabio Estevam <festevam@...il.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: Kernel crashes in phy_attach_direct()
> 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
Powered by blists - more mailing lists