]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
phy: Reset init count on phy exit failure
authorMarek Vasut <marek.vasut@mailbox.org>
Sat, 6 Sep 2025 23:00:44 +0000 (01:00 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 16 Sep 2025 22:14:03 +0000 (16:14 -0600)
In case the PHY exit callback reports failure, reset init_count to 0 anyway,
so the next attempt at PHY initialization might try to reinitialize the PHY
and restore it to normal operation.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
drivers/phy/phy-uclass.c

index 714be12385670ce21d7b78459659105e6bcdb07f..f8d4fb3b41b36a4727da9a5685e25f7b14181747 100644 (file)
@@ -274,7 +274,7 @@ int generic_phy_exit(struct phy *phy)
 {
        struct phy_counts *counts;
        struct phy_ops const *ops;
-       int ret;
+       int ret = 0;
 
        if (!generic_phy_valid(phy))
                return 0;
@@ -292,12 +292,11 @@ int generic_phy_exit(struct phy *phy)
                if (ret) {
                        dev_err(phy->dev, "PHY: Failed to exit %s: %d.\n",
                                phy->dev->name, ret);
-                       return ret;
                }
        }
        counts->init_count = 0;
 
-       return 0;
+       return ret;
 }
 
 int generic_phy_power_on(struct phy *phy)