aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-02-19 21:32:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-19 21:50:21 -0500
commitb29c7690a764b9829b1034f873f97b7bbfa19565 (patch)
treed77789334e777bb67a429f0a69024cec4bb64906 /drivers/regulator/core.c
parentfde297bb4d8075229b8985e9d4f96d32339a8e68 (diff)
regulator: Simplify regulator_bulk_get and regulator_bulk_enable error paths
Start unwind from the point the error happens instead of iterating over all consumers, then unwind code can be simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9a143aebb84b..6c845200a530 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2397,7 +2397,7 @@ int regulator_bulk_get(struct device *dev, int num_consumers,
2397 return 0; 2397 return 0;
2398 2398
2399err: 2399err:
2400 for (i = 0; i < num_consumers && consumers[i].consumer; i++) 2400 while (--i >= 0)
2401 regulator_put(consumers[i].consumer); 2401 regulator_put(consumers[i].consumer);
2402 2402
2403 return ret; 2403 return ret;
@@ -2447,12 +2447,9 @@ int regulator_bulk_enable(int num_consumers,
2447 return 0; 2447 return 0;
2448 2448
2449err: 2449err:
2450 for (i = 0; i < num_consumers; i++) 2450 pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
2451 if (consumers[i].ret == 0) 2451 while (--i >= 0)
2452 regulator_disable(consumers[i].consumer); 2452 regulator_disable(consumers[i].consumer);
2453 else
2454 pr_err("Failed to enable %s: %d\n",
2455 consumers[i].supply, consumers[i].ret);
2456 2453
2457 return ret; 2454 return ret;
2458} 2455}