[PATCH] net: phy: Fix crash when no phy is found

Sascha Hauer s.hauer at pengutronix.de
Fri Jan 17 10:00:56 EST 2014


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/phy/phy.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 6ca1bb2..faa5c26 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -290,6 +290,11 @@ int phy_device_connect(struct eth_device *edev, struct mii_bus *bus, int addr,
 			if (!IS_ERR(dev) && !dev->attached_dev)
                                 break;
 		}
+
+		if (IS_ERR(dev)) {
+			ret = PTR_ERR(dev);
+			goto fail;
+		}
 	}
 
 	if (dev->attached_dev)
-- 
1.8.5.2




More information about the barebox mailing list