From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
computersforpeace@gmail.com, andrey.volkov@nexvision.fr,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net 1/2] net: dsa: handle non-existing PHYs on switch internal bus
Date: Tue, 16 Dec 2014 11:24:02 +0100 [thread overview]
Message-ID: <20141216102402.GF1450@lunn.ch> (raw)
In-Reply-To: <1418330956-17151-2-git-send-email-f.fainelli@gmail.com>
On Thu, Dec 11, 2014 at 12:49:15PM -0800, Florian Fainelli wrote:
> In case there is no PHY at the designated address on the internal
> switch, we would basically de-reference a null pointer here:
>
> dsa_slave_phy_setup(...)
> {
> p->phy = ds->slave_mii_bus->phy_map[p->port];
> phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
> ^------
>
> This can be triggered when the platform configuration (platform_data or
> Device Tree) indicates there should be a PHY device at this address, but
> the HW is non-responsive, such that we cannot attach a PHY device at
> this specific location.
>
> Fix this by checking the return value prior to calling
> phy_connect_direct().
>
> CC: Andrew Lunn <andrew@lunn.ch>
> Fixes: b31f65fb4383 ("net: dsa: slave: Fix autoneg for phys on switch MDIO bus")
> Reported-by: Brian Norris <computersforpeace@gmail.com>
> Signed-off-by: Andrey Volkov <andrey.volkov@nexvision.fr>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Andrew
> ---
> net/dsa/slave.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index ab03e00ffe8f..0efaab1e408b 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -491,6 +491,9 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p,
> */
> if (!p->phy) {
> p->phy = ds->slave_mii_bus->phy_map[p->port];
> + if (!p->phy)
> + return;
> +
> phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
> p->phy_interface);
> } else {
> --
> 2.1.0
>
next prev parent reply other threads:[~2014-12-16 10:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 20:49 [PATCH net 0/2] net: dsa: two small bug fixes Florian Fainelli
2014-12-11 20:49 ` [PATCH net 1/2] net: dsa: handle non-existing PHYs on switch internal bus Florian Fainelli
2014-12-16 10:24 ` Andrew Lunn [this message]
2014-12-11 20:49 ` [PATCH net 2/2] net: dsa: propagate error code from dsa_slave_phy_setup Florian Fainelli
2014-12-12 2:00 ` [PATCH net 0/2] net: dsa: two small bug fixes David Miller
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=20141216102402.GF1450@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrey.volkov@nexvision.fr \
--cc=computersforpeace@gmail.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@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).