summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-08 08:41:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-08 08:41:18 +0200
commitaf250795bcdb29ecf062c709148a8561b138c7ba (patch)
tree2494ba846bc4fd13505d3f43564c1a45bca69add
parentf33c0cec75ce9a4cfc231ef336406b506a8c270e (diff)
parent57c9a40d8e3a437dbbaa8e463008eaf22214e5c8 (diff)
downloadbarebox-af250795bcdb29ecf062c709148a8561b138c7ba.tar.gz
barebox-af250795bcdb29ecf062c709148a8561b138c7ba.tar.xz
Merge branch 'for-next/net'
-rw-r--r--drivers/net/phy/phy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7132516aa1..35a9ce7ea8 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);
@@ -405,6 +405,11 @@ int phy_device_connect(struct eth_device *edev, struct mii_bus *bus, int addr,
goto out;
}
+ if (!bus) {
+ ret = -ENODEV;
+ goto out;
+ }
+
if (addr >= 0) {
phy = mdiobus_scan(bus, addr);
if (IS_ERR(phy)) {