netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Fabio Estevam <festevam@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: Kernel crashes in phy_attach_direct()
Date: Wed, 8 Feb 2017 15:51:48 +0100	[thread overview]
Message-ID: <20170208145148.GF10855@lunn.ch> (raw)
In-Reply-To: <CAOMZO5CjRbvPJjNDGkOFjz+AZ1ydN9+SRBsypCPyNocPoFOdRA@mail.gmail.com>

> 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

  reply	other threads:[~2017-02-08 15:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 12:58 Kernel crashes in phy_attach_direct() Fabio Estevam
2017-02-08 14:28 ` Andrew Lunn
2017-02-08 14:34   ` Fabio Estevam
2017-02-08 14:40     ` Andrew Lunn
2017-02-08 14:47       ` Fabio Estevam
2017-02-08 14:51         ` Andrew Lunn [this message]
2017-02-08 16:39           ` Florian Fainelli
  -- strict thread matches above, loose matches on Subject: below --
2017-02-08 14:41 Nikita Yushchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208145148.GF10855@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=festevam@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).