net: mvneta: Fix fault when wrong device tree
[platform/kernel/u-boot.git] / drivers / net / mvneta.c
index 6eacd61..7036b51 100644 (file)
@@ -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);