From: Marek BehĂșn Date: Tue, 24 Apr 2018 15:21:29 +0000 (+0200) Subject: net: mvneta: Fix fault when wrong device tree X-Git-Tag: v2018.07-rc1~155^2~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cf2cf8510a10d954ea46b4a49a7bf9d95cccf4bd;p=u-boot net: mvneta: Fix fault when wrong device tree The driver does not check id phy_connect failed (for example on wrong property name in device tree). In such a case a fault occurs and the CPU is restarted. Signed-off-by: Marek Behun Reviewed-by: Stefan Roese Signed-off-by: Stefan Roese --- diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 6eacd6116a..7036b517b4 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -1562,6 +1562,10 @@ static int mvneta_start(struct udevice *dev) phydev = phy_connect(pp->bus, pp->phyaddr, dev, pp->phy_interface); + if (!phydev) { + printf("phy_connect failed\n"); + return -ENODEV; + } pp->phydev = phydev; phy_config(phydev);