[U-Boot] [PATCH v1 19/19] net: mvneta: Fix fault when wrong device tree
Marek BehĂșn
marek.behun at nic.cz
Wed Mar 7 21:52:16 UTC 2018
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 at nic.cz>
---
drivers/net/mvneta.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 83e3153768..7403ccbd3c 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -1554,6 +1554,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 -1;
+ }
pp->phydev = phydev;
phy_config(phydev);
--
2.16.1
More information about the U-Boot
mailing list