public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.8-stable] regulator: fixed regulator_bulk_enable unwinding code
@ 2013-04-23  2:56 Jonghwan Choi
  2013-04-23 10:51 ` Luis Henriques
  0 siblings, 1 reply; 2+ messages in thread
From: Jonghwan Choi @ 2013-04-23  2:56 UTC (permalink / raw)
  To: 'Jonghwan Choi', linux-kernel
  Cc: stable, 'Andrzej Hajda', 'Liam Girdwood',
	'Mark Brown'

3.8-stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Andrzej Hajda <a.hajda@samsung.com>"

commit fbe31057fafebdc2811a7101b8b4a0460f5417d1 upstream.

Unwinding code disables all successfully enabled regulators.
Error is logged for every failed regulator.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
 drivers/regulator/core.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5a0f54a..e56185b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3032,9 +3032,13 @@ int regulator_bulk_enable(int num_consumers,
 	return 0;
 
 err:
-	pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
-	while (--i >= 0)
-		regulator_disable(consumers[i].consumer);
+	for (i = 0; i < num_consumers; i++) {
+		if (consumers[i].ret < 0)
+			pr_err("Failed to enable %s: %d\n",
consumers[i].supply,
+			       consumers[i].ret);
+		else
+			regulator_disable(consumers[i].consumer);
+	}
 
 	return ret;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3.8-stable] regulator: fixed regulator_bulk_enable unwinding code
  2013-04-23  2:56 [PATCH 3.8-stable] regulator: fixed regulator_bulk_enable unwinding code Jonghwan Choi
@ 2013-04-23 10:51 ` Luis Henriques
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Henriques @ 2013-04-23 10:51 UTC (permalink / raw)
  To: Jonghwan Choi
  Cc: linux-kernel, stable, 'Andrzej Hajda',
	'Liam Girdwood', 'Mark Brown'

On Tue, Apr 23, 2013 at 11:56:25AM +0900, Jonghwan Choi wrote:
> 3.8-stable review patch.  If anyone has any objections, please let me know.

Thanks, I believe this is also applicable to 3.4.y and 3.5.y.

Cheers,
--
Luis

> 
> ------------------
> 
> From: "Andrzej Hajda <a.hajda@samsung.com>"
> 
> commit fbe31057fafebdc2811a7101b8b4a0460f5417d1 upstream.
> 
> Unwinding code disables all successfully enabled regulators.
> Error is logged for every failed regulator.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
> ---
>  drivers/regulator/core.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 5a0f54a..e56185b 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -3032,9 +3032,13 @@ int regulator_bulk_enable(int num_consumers,
>  	return 0;
>  
>  err:
> -	pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
> -	while (--i >= 0)
> -		regulator_disable(consumers[i].consumer);
> +	for (i = 0; i < num_consumers; i++) {
> +		if (consumers[i].ret < 0)
> +			pr_err("Failed to enable %s: %d\n",
> consumers[i].supply,
> +			       consumers[i].ret);
> +		else
> +			regulator_disable(consumers[i].consumer);
> +	}
>  
>  	return ret;
>  }
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-23 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23  2:56 [PATCH 3.8-stable] regulator: fixed regulator_bulk_enable unwinding code Jonghwan Choi
2013-04-23 10:51 ` Luis Henriques

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox