]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: Avoid null pointer when failing to connect to PHY
authorVladimir Oltean <olteanv@gmail.com>
Sat, 23 Mar 2019 23:24:07 +0000 (01:24 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Mar 2019 18:26:55 +0000 (11:26 -0700)
commitb0033e22bbb1a11c278ec305f8fc6e114103e8c2
treefc04d26f6cc2f095c3fccfa781931a8920fb0eb6
parent3f9c53e6ce08589ef4d466ec59a34224c8f2adde
net: dsa: Avoid null pointer when failing to connect to PHY

When phylink_of_phy_connect fails, dsa_slave_phy_setup tries to save the
day by connecting to an alternative PHY, none other than a PHY on the
switch's internal MDIO bus, at an address equal to the port's index.

However this does not take into consideration the scenario when the
switch that failed to probe an external PHY does not have an internal
MDIO bus at all.

Fixes: a81bccb0d343 ("net: dsa: Plug in PHYLINK support")
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/slave.c