summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2017-08-27 08:52:00 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-06 13:58:52 +0200
commitc4531782266fafe767cd913baecc8c5d270fac76 (patch)
tree4b7149a3c69113ef303fe466da6b8ea8529dc21e /drivers/net/phy/phy.c
parentd79a81736f64eef5d19396ad04ee9391bc384a8e (diff)
downloadbarebox-c4531782266fafe767cd913baecc8c5d270fac76.tar.gz
barebox-c4531782266fafe767cd913baecc8c5d270fac76.tar.xz
phy: don't crash if we have no parent
current code will crash if DT has no PHY entry. With this patch we will test if parent exist, before testing the parent device node. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7132516aa1..25ae40233e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -323,7 +323,7 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev)
if (!IS_ENABLED(CONFIG_OFDEVICE))
return NULL;
- if (!edev->parent->device_node)
+ if (!edev->parent || !edev->parent->device_node)
return NULL;
phy_node = of_parse_phandle(edev->parent->device_node, "phy-handle", 0);