summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-12-11 10:56:29 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-12-11 10:56:31 +0100
commitd023d690fc6fd051faa77666777d9664e0e5e7e3 (patch)
treefb9a227d06d72dfc8bc99b51fab454dafd702e58 /drivers
parent664694d9f72ae8782f9d923e8813e2f51df2a2b7 (diff)
downloadbarebox-d023d690fc6fd051faa77666777d9664e0e5e7e3.tar.gz
barebox-d023d690fc6fd051faa77666777d9664e0e5e7e3.tar.xz
net: phy: check if a phy already has an ethernet device
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@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/phy.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fb4cb118bc..37f6647025 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;