net: tsec: Fix NULL access in case init_phy() fails

If the PHY is not recognized don't access phydev (NULL)
and return 0 to signal failure.

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
Claudiu Manoil 2013-12-10 15:21:04 +02:00 committed by Joe Hershberger
parent 2af13d6b62
commit 7f233c0557
1 changed files with 2 additions and 0 deletions

View File

@ -597,6 +597,8 @@ static int init_phy(struct eth_device *dev)
tsec_configure_serdes(priv);
phydev = phy_connect(priv->bus, priv->phyaddr, dev, priv->interface);
if (!phydev)
return 0;
phydev->supported &= supported;
phydev->advertising = phydev->supported;