Commit fe1c3ef2 authored by Russell King's avatar Russell King Committed by David S. Miller

phylink: avoid attaching more than one PHY

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: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 29635762
...@@ -725,6 +725,9 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) ...@@ -725,6 +725,9 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
phy_interface_mode_is_8023z(pl->link_interface)))) phy_interface_mode_is_8023z(pl->link_interface))))
return -EINVAL; return -EINVAL;
if (pl->phydev)
return -EBUSY;
/* Use PHY device/driver interface */ /* Use PHY device/driver interface */
if (pl->link_interface == PHY_INTERFACE_MODE_NA) { if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
pl->link_interface = phy->interface; pl->link_interface = phy->interface;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment