diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-12-11 21:49:15 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-12 02:58:50 +0100 |
commit | 53013c77437c9b00658fc112b4e0aecd221c512a (patch) | |
tree | 1213107ad4e164d2443e43845d7553d1bff07a65 /net/dsa | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next (diff) | |
download | linux-53013c77437c9b00658fc112b4e0aecd221c512a.tar.xz linux-53013c77437c9b00658fc112b4e0aecd221c512a.zip |
net: dsa: handle non-existing PHYs on switch internal bus
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 528380a3e296..da64ba9d825d 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -555,6 +555,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 { |