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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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


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




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux