phy: samsung-ufs: ufs: exit on first reported error
authorPeter Griffin <peter.griffin@linaro.org>
Fri, 26 Apr 2024 10:41:29 +0000 (11:41 +0100)
committerVinod Koul <vkoul@kernel.org>
Sat, 4 May 2024 11:54:28 +0000 (17:24 +0530)
To preserve the err value, exit the loop immediately if an error
is returned.

Fixes: f2c6d0fa197a ("phy: samsung-ufs: use exynos_get_pmu_regmap_by_phandle() to obtain PMU regmap")
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20240426104129.2211949-3-peter.griffin@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/samsung/phy-samsung-ufs.c

index ffc46c953ed64c9cc8eb4dd995bafeda54060d68..6c5d41552649a95f26801620fc7fbfde97a36b04 100644 (file)
@@ -99,12 +99,18 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
 
        for_each_phy_lane(ufs_phy, i) {
                if (ufs_phy->ufs_phy_state == CFG_PRE_INIT &&
-                   ufs_phy->drvdata->wait_for_cal)
+                   ufs_phy->drvdata->wait_for_cal) {
                        err = ufs_phy->drvdata->wait_for_cal(phy, i);
+                       if (err)
+                               goto out;
+               }
 
                if (ufs_phy->ufs_phy_state == CFG_POST_PWR_HS &&
-                   ufs_phy->drvdata->wait_for_cdr)
+                   ufs_phy->drvdata->wait_for_cdr) {
                        err = ufs_phy->drvdata->wait_for_cdr(phy, i);
+                       if (err)
+                               goto out;
+               }
        }
 
        /**