[U-Boot] [PATCH 1/2] net: tsec: Fix NULL access in case init_phy() fails

Claudiu Manoil claudiu.manoil at freescale.com
Tue Dec 10 14:21:04 CET 2013


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

Signed-off-by: Claudiu Manoil <claudiu.manoil at freescale.com>
---
 drivers/net/tsec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index e9138f0..65fb2b0 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -590,6 +590,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;
-- 
1.7.11.7




More information about the U-Boot mailing list