From 7f233c05573fabe8ff1ed7f22c269cdfdfc30529 Mon Sep 17 00:00:00 2001 From: Claudiu Manoil Date: Tue, 10 Dec 2013 15:21:04 +0200 Subject: [PATCH] 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 --- drivers/net/tsec.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.25.1