Skip to content

Commit

Permalink
regulator: fixed regulator_bulk_enable unwinding code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrzej Hajda authored and Mark Brown committed Mar 1, 2013
1 parent 2730fd8 commit fbe3105
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 @@ -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;
}
Expand Down

0 comments on commit fbe3105

Please sign in to comment.