net: tsec: Fix NULL access in case init_phy() fails
authorClaudiu Manoil <claudiu.manoil@freescale.com>
Tue, 10 Dec 2013 13:21:04 +0000 (15:21 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Fri, 30 Jan 2015 21:55:00 +0000 (15:55 -0600)
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>
drivers/net/tsec.c

index 79d656133adb4d50a7a28dfb529f81121db708ac..dcdba4ea827190759ea9ab0de43239a02024a096 100644 (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;