Skip to contentSkip to conversation

OPP: core: Fix loop in dev_pm_opp_sync_regulators()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OPP: core: Fix loop in dev_pm_opp_sync_regulators()

We accidentally deleted the if statement in this loop during a cleanup. Add it back.

Fixes 5330d0dab736 ("OPP: Define and use scope-based cleanup helpers")
---
 drivers/opp/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/opp/core.c +4 -2
index fc9874946453..f56ddae35ef2 100644
@@ -2889,7 +2889,7 @@ int dev_pm_opp_sync_regulators(struct device *dev)
 {
 	struct opp_table *opp_table __free(put_opp_table);
 	struct regulator *reg;
-	int i;
+	int i, ret;
 
 	/* Device may not have OPP table */
 	opp_table = _find_opp_table(dev);
@@ -2906,7 +2906,9 @@ int dev_pm_opp_sync_regulators(struct device *dev)
 
 	for (i = 0; i < opp_table->regulator_count; i++) {
 		reg = opp_table->regulators[i];
-		return regulator_sync_voltage(reg);
+		ret = regulator_sync_voltage(reg);
+		if (ret)
+			return ret;
 	}
 
 	return 0;
Signature · 1 line
2.47.2
#1 lore raw
Quoted 23 lines · Dan Carpenter

We accidentally deleted the if statement in this loop during a cleanup. Add it back.

Fixes 5330d0dab736 ("OPP: Define and use scope-based cleanup helpers")
---
 drivers/opp/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/opp/core.c +1 -1
index fc9874946453..f56ddae35ef2 100644
@@ -2889,7 +2889,7 @@ int dev_pm_opp_sync_regulators(struct device *dev)
 {
 	struct opp_table *opp_table __free(put_opp_table);
 	struct regulator *reg;
-	int i;
+	int i, ret;
 
 	/* Device may not have OPP table */
 	opp_table = _find_opp_table(dev);

drivers/opp/core.c int dev_pm_opp_sync_regulators(struct device *dev) · line 2914

Quoted 10 lines
drivers/opp/core.c +3 -1
@@ -2906,7 +2906,9 @@ int dev_pm_opp_sync_regulators(struct device *dev)
 
 	for (i = 0; i < opp_table->regulator_count; i++) {
 		reg = opp_table->regulators[i];
-		return regulator_sync_voltage(reg);
+		ret = regulator_sync_voltage(reg);
+		if (ret)
+			return ret;
 	}
 
 	return 0;

Ahh, thanks for the fix Dan. I have folded this in the original patch itself.

Signature · 1 line
viresh