Message ID | 20200917034310.2360488-3-f.fainelli@gmail.com |
---|---|
State | New |
Headers | show |
Series | net: phy: Unbind fixes | expand |
On Wed, Sep 16, 2020 at 08:43:10PM -0700, Florian Fainelli wrote: > When phy_is_started() was added to catch incorrect PHY states, > phy_stop() would not be qualified against PHY_DOWN. It is possible to > reach that state when the PHY driver has been unbound and the network > device is then brought down. > > Fixes: 2b3e88ea6528 ("net: phy: improve phy state checking") > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 735a806045ac..8947d58f2a25 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -996,7 +996,7 @@ void phy_stop(struct phy_device *phydev) { struct net_device *dev = phydev->attached_dev; - if (!phy_is_started(phydev)) { + if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) { WARN(1, "called from state %s\n", phy_state_to_str(phydev->state)); return;
When phy_is_started() was added to catch incorrect PHY states, phy_stop() would not be qualified against PHY_DOWN. It is possible to reach that state when the PHY driver has been unbound and the network device is then brought down. Fixes: 2b3e88ea6528 ("net: phy: improve phy state checking") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)