Skip to content

Commit

Permalink
phylink: avoid attaching more than one PHY
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Russell King authored and David S. Miller committed Dec 21, 2017
1 parent 2963576 commit fe1c3ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,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;
Expand Down

0 comments on commit fe1c3ef

Please sign in to comment.