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>
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 6eacd61..7036b51 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -1562,6 +1562,10 @@
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);