summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2018-04-24 17:21:29 +0200
committerStefan Roese <sr@denx.de>2018-05-14 10:00:15 +0200
commitcf2cf8510a10d954ea46b4a49a7bf9d95cccf4bd (patch)
treee21861997232b26764a0fa30ac15ea887fb466e6 /drivers/net
parent2d7a0f4399f924422e959613b4c2634dcd0ad87e (diff)
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 <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/mvneta.c4
1 files changed, 4 insertions, 0 deletions
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);