netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] phylink: avoid attaching more than one PHY
@ 2017-12-20 23:23 Russell King
  2017-12-21 11:41 ` Andrew Lunn
  2017-12-21 20:03 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Russell King @ 2017-12-20 23:23 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli; +Cc: netdev

Attaching more than one PHY to phylink is bad news, as we store a
pointer to the PHY in a single location. Error out if more than one
PHY is attempted to be attached.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index db5d5726ced9..82166a26f5c6 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -726,6 +726,9 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
 		     phy_interface_mode_is_8023z(pl->link_interface))))
 		return -EINVAL;
 
+	if (pl->phydev)
+		return -EBUSY;
+
 	/* Use PHY device/driver interface */
 	if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
 		pl->link_interface = phy->interface;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-21 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20 23:23 [PATCH net-next] phylink: avoid attaching more than one PHY Russell King
2017-12-21 11:41 ` Andrew Lunn
2017-12-21 20:03 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).