mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] phy: don't crush if we have no parent
@ 2017-08-27  6:52 Oleksij Rempel
  2017-09-06 11:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2017-08-27  6:52 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

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>
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7132516aa..25ae40233 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);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-06 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-27  6:52 [PATCH] phy: don't crush if we have no parent Oleksij Rempel
2017-09-06 11:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox