regulator: core: Complain if we can't reenable a supply
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 28 Mar 2012 20:36:38 +0000 (21:36 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 3 Apr 2012 13:00:46 +0000 (14:00 +0100)
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>
drivers/regulator/core.c

index c056abd7562a29b91666083371d888a698b85eef..fe28481dc91c45c515b6b0cad95a0daa08f35b11 100644 (file)
@@ -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);
@@ -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;
 }