diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-12-20 18:23:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-21 15:03:10 -0500 |
commit | fe1c3ef201c1ae629df9ee60b64e7030f6e703fb (patch) | |
tree | ece6c0dee56a378d7c6bba56156fd01e65090b11 | |
parent | 29635762be4c18a3bb24338ea338515a171b67a6 (diff) |
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: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/phylink.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index f7a777475762..2ec140ec7923 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c | |||
@@ -725,6 +725,9 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) | |||
725 | phy_interface_mode_is_8023z(pl->link_interface)))) | 725 | phy_interface_mode_is_8023z(pl->link_interface)))) |
726 | return -EINVAL; | 726 | return -EINVAL; |
727 | 727 | ||
728 | if (pl->phydev) | ||
729 | return -EBUSY; | ||
730 | |||
728 | /* Use PHY device/driver interface */ | 731 | /* Use PHY device/driver interface */ |
729 | if (pl->link_interface == PHY_INTERFACE_MODE_NA) { | 732 | if (pl->link_interface == PHY_INTERFACE_MODE_NA) { |
730 | pl->link_interface = phy->interface; | 733 | pl->link_interface = phy->interface; |