From: Claudiu Manoil Date: Tue, 10 Dec 2013 13:21:04 +0000 (+0200) Subject: net: tsec: Fix NULL access in case init_phy() fails X-Git-Tag: v2015.04-rc1~5^2~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7f233c05573fabe8ff1ed7f22c269cdfdfc30529;p=oweals%2Fu-boot.git 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 Signed-off-by: Joe Hershberger --- diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 79d656133a..dcdba4ea82 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -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;