From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqiAf-0000hL-PM for barebox@lists.infradead.org; Wed, 11 Dec 2013 11:41:43 +0000 From: Sascha Hauer Date: Wed, 11 Dec 2013 12:41:12 +0100 Message-Id: <1386762077-23205-5-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1386762077-23205-1-git-send-email-s.hauer@pengutronix.de> References: <1386762077-23205-1-git-send-email-s.hauer@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 4/9] net: phy: check if a phy already has an ethernet device To: barebox@lists.infradead.org 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 --- 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@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox