Every driver should have called phy_stop() before calling
phy_disconnect(). Let's check for this and ensure PHY is stopped
when starting with the actual work in phy_disconnect().

Signed-off-by: Heiner Kallweit <hkallwe...@gmail.com>
---
 drivers/net/phy/phy_device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b5f5cda4c..46ec71021 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -999,6 +999,11 @@ EXPORT_SYMBOL(phy_connect);
  */
 void phy_disconnect(struct phy_device *phydev)
 {
+       if (phy_is_started(phydev)) {
+               phydev_warn(phydev, "phy_stop should have been called before 
phy_disconnect!\n");
+               phy_stop(phydev);
+       }
+
        if (phydev->irq > 0)
                phy_stop_interrupts(phydev);
 
-- 
2.20.1


Reply via email to