public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonghwan Choi <jhbird.choi@samsung.com>
To: "'Jonghwan Choi'" <jhbird.choi@samsung.com>,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, "'Andrzej Hajda'" <a.hajda@samsung.com>,
	"'Liam Girdwood'" <lrg@ti.com>,
	"'Mark Brown'" <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 3.8-stable] regulator: fixed regulator_bulk_enable unwinding code
Date: Tue, 23 Apr 2013 11:56:25 +0900	[thread overview]
Message-ID: <006f01ce3fce$25072080$6f156180$%choi@samsung.com> (raw)
In-Reply-To: 

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


             reply	other threads:[~2013-04-23  2:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23  2:56 Jonghwan Choi [this message]
2013-04-23 10:51 ` [PATCH 3.8-stable] regulator: fixed regulator_bulk_enable unwinding code Luis Henriques

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='006f01ce3fce$25072080$6f156180$%choi@samsung.com' \
    --to=jhbird.choi@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox