[PATCH 4/9] net: phy: check if a phy already has an ethernet device

Sascha Hauer s.hauer at pengutronix.de
Wed Dec 11 06:41:12 EST 2013


If during a phy_device_connect a phy already has an ehternet device
this can only mean it's already attached to another device. return -EBUSY
in this case.

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

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fb4cb11..37f6647 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -281,6 +281,9 @@ int phy_device_connect(struct eth_device *edev, struct mii_bus *bus, int addr,
 		}
 	}
 
+	if (dev->attached_dev)
+		return -EBUSY;
+
 	dev->interface = interface;
 	dev->dev_flags = flags;
 
-- 
1.8.5.1




More information about the barebox mailing list