diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2013-03-01 12:24:05 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-01 20:03:46 +0800 |
commit | fbe31057fafebdc2811a7101b8b4a0460f5417d1 (patch) | |
tree | 6656af04f0437024f2c8c77eab21aa28d5daa4ab /drivers/regulator/core.c | |
parent | 2730fd82cbb922e6be8df08ba32c21be41757d3d (diff) | |
download | lwn-fbe31057fafebdc2811a7101b8b4a0460f5417d1.tar.gz lwn-fbe31057fafebdc2811a7101b8b4a0460f5417d1.zip |
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/core.c')
-rw-r--r-- | drivers/regulator/core.c | 10 |
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; } |