Skip to content

Commit

Permalink
regulator: core: Complain if we can't reenable a supply
Browse files Browse the repository at this point in the history
When cleaning up after a failed bulk_disable() we try to reenable any
supplies that we did manage to disable - complain if we fail to do that
when we try.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Apr 3, 2012
1 parent dd775ae commit 01e86f4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers)
{
int i;
int ret;
int ret, r;

for (i = num_consumers - 1; i >= 0; --i) {
ret = regulator_disable(consumers[i].consumer);
Expand All @@ -2578,8 +2578,12 @@ int regulator_bulk_disable(int num_consumers,

err:
pr_err("Failed to disable %s: %d\n", consumers[i].supply, ret);
for (++i; i < num_consumers; ++i)
regulator_enable(consumers[i].consumer);
for (++i; i < num_consumers; ++i) {
r = regulator_enable(consumers[i].consumer);
if (r != 0)
pr_err("Failed to reename %s: %d\n",
consumers[i].supply, r);
}

return ret;
}
Expand Down

0 comments on commit 01e86f4

Please sign in to comment.