diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-12-11 10:56:29 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-12-11 10:56:31 +0100 |
commit | d023d690fc6fd051faa77666777d9664e0e5e7e3 (patch) | |
tree | fb9a227d06d72dfc8bc99b51fab454dafd702e58 /drivers | |
parent | 664694d9f72ae8782f9d923e8813e2f51df2a2b7 (diff) | |
download | barebox-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.c | 3 |
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; |