net: ravb: Keep the reverse order of operations in ravb_close()
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Wed, 14 Feb 2024 13:57:56 +0000 (15:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Feb 2024 08:32:03 +0000 (08:32 +0000)
Keep the reverse order of operations in ravb_close() when compared with
ravb_open(). This is the recommended configuration sequence.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/ravb_main.c

index 129965566c07ebb1253d2d6630e1d708a4544067..b2699c76ed9f8ca13063532133dbfe6bd6488338 100644 (file)
@@ -2317,6 +2317,14 @@ static int ravb_close(struct net_device *ndev)
        ravb_write(ndev, 0, RIC2);
        ravb_write(ndev, 0, TIC);
 
+       /* PHY disconnect */
+       if (ndev->phydev) {
+               phy_stop(ndev->phydev);
+               phy_disconnect(ndev->phydev);
+               if (of_phy_is_fixed_link(np))
+                       of_phy_deregister_fixed_link(np);
+       }
+
        /* Stop PTP Clock driver */
        if (info->gptp || info->ccc_gac)
                ravb_ptp_stop(ndev);
@@ -2335,14 +2343,6 @@ static int ravb_close(struct net_device *ndev)
                }
        }
 
-       /* PHY disconnect */
-       if (ndev->phydev) {
-               phy_stop(ndev->phydev);
-               phy_disconnect(ndev->phydev);
-               if (of_phy_is_fixed_link(np))
-                       of_phy_deregister_fixed_link(np);
-       }
-
        cancel_work_sync(&priv->work);
 
        if (info->nc_queues)