public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: fixed regulator_bulk_enable unwinding code
@ 2013-03-01 11:24 Andrzej Hajda
  2013-03-01 12:04 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Hajda @ 2013-03-01 11:24 UTC (permalink / raw)
  To: Mark Brown, linux-kernel; +Cc: Marek Szyprowski, Andrzej Hajda, Kyungmin Park

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>
---
 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 2785843..90af271 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.10.4


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

* Re: [PATCH] regulator: fixed regulator_bulk_enable unwinding code
  2013-03-01 11:24 [PATCH] regulator: fixed regulator_bulk_enable unwinding code Andrzej Hajda
@ 2013-03-01 12:04 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-03-01 12:04 UTC (permalink / raw)
  To: Andrzej Hajda; +Cc: linux-kernel, Marek Szyprowski, Kyungmin Park

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

On Fri, Mar 01, 2013 at 12:24:05PM +0100, Andrzej Hajda wrote:
> Unwinding code disables all successfully enabled regulators.
> Error is logged for every failed regulator.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-03-01 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-01 11:24 [PATCH] regulator: fixed regulator_bulk_enable unwinding code Andrzej Hajda
2013-03-01 12:04 ` Mark Brown

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