]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: mvneta: Fix fault when wrong device tree
authorMarek BehĂșn <marek.behun@nic.cz>
Tue, 24 Apr 2018 15:21:29 +0000 (17:21 +0200)
committerStefan Roese <sr@denx.de>
Mon, 14 May 2018 08:00:15 +0000 (10:00 +0200)
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>
drivers/net/mvneta.c

index 6eacd6116ae022715123f5894415a8b21b9fb2dd..7036b517b4450ad775470b30ea09681d1c4755d1 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);