aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2009-12-15 08:30:01 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-12-17 05:27:28 -0500
commiteb143ac1b9f56ca9c6dc782d795acda1f60c5fd2 (patch)
tree33a56cd82ee52eb613c9fb81bbcf8f15586e7f49 /drivers
parentfa2984d4691c96367d6666694ecc6744135174c6 (diff)
regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path
Currently it is possible for regulator_bulk_{enable,disable} operations to generate unbalanced regulator_{disable,enable} calls in its error path. In case of an error only those regulators of the bulk operation which actually had been enabled/disabled should get their original state restored. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1af8df203b72..686ef270ecf7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1977,7 +1977,7 @@ int regulator_bulk_enable(int num_consumers,
1977 1977
1978err: 1978err:
1979 printk(KERN_ERR "Failed to enable %s: %d\n", consumers[i].supply, ret); 1979 printk(KERN_ERR "Failed to enable %s: %d\n", consumers[i].supply, ret);
1980 for (i = 0; i < num_consumers; i++) 1980 for (--i; i >= 0; --i)
1981 regulator_disable(consumers[i].consumer); 1981 regulator_disable(consumers[i].consumer);
1982 1982
1983 return ret; 1983 return ret;
@@ -2013,7 +2013,7 @@ int regulator_bulk_disable(int num_consumers,
2013err: 2013err:
2014 printk(KERN_ERR "Failed to disable %s: %d\n", consumers[i].supply, 2014 printk(KERN_ERR "Failed to disable %s: %d\n", consumers[i].supply,
2015 ret); 2015 ret);
2016 for (i = 0; i < num_consumers; i++) 2016 for (--i; i >= 0; --i)
2017 regulator_enable(consumers[i].consumer); 2017 regulator_enable(consumers[i].consumer);
2018 2018
2019 return ret; 2019 return ret;