[PATCH next] OPP: core: Fix loop in dev_pm_opp_sync_regulators()

Dan Carpenter posted 1 patch 9 months, 2 weeks ago
drivers/opp/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH next] OPP: core: Fix loop in dev_pm_opp_sync_regulators()
Posted by Dan Carpenter 9 months, 2 weeks ago
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")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/opp/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index fc9874946453..f56ddae35ef2 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -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;
-- 
2.47.2
Re: [PATCH next] OPP: core: Fix loop in dev_pm_opp_sync_regulators()
Posted by Viresh Kumar 9 months, 2 weeks ago
On 30-04-25, 11:07, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/opp/core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index fc9874946453..f56ddae35ef2 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -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;

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

-- 
viresh