summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2013-03-01 15:24:05 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-01 16:03:46 +0400
commitfbe31057fafebdc2811a7101b8b4a0460f5417d1 (patch)
tree6656af04f0437024f2c8c77eab21aa28d5daa4ab /drivers/regulator
parent2730fd82cbb922e6be8df08ba32c21be41757d3d (diff)
downloadlinux-fbe31057fafebdc2811a7101b8b4a0460f5417d1.tar.xz
regulator: fixed regulator_bulk_enable unwinding code
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index da9782bd27d0..4a7790c58257 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3057,9 +3057,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;
}