mfd: arizona: Clean up on failed runtime resume
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 14 Jan 2013 06:50:38 +0000 (15:50 +0900)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 8 Apr 2013 13:20:56 +0000 (15:20 +0200)
Make sure that we don't leave the device enabled needlessly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/arizona-core.c

index b562c7b..0962c55 100644 (file)
@@ -235,18 +235,21 @@ static int arizona_runtime_resume(struct device *dev)
 
        ret = arizona_wait_for_boot(arizona);
        if (ret != 0) {
-               regulator_disable(arizona->dcvdd);
-               return ret;
+               goto err;
        }
 
        ret = regcache_sync(arizona->regmap);
        if (ret != 0) {
                dev_err(arizona->dev, "Failed to restore register cache\n");
-               regulator_disable(arizona->dcvdd);
-               return ret;
+               goto err;
        }
 
        return 0;
+
+err:
+       regcache_cache_only(arizona->regmap, true);
+       regulator_disable(arizona->dcvdd);
+       return ret;
 }
 
 static int arizona_runtime_suspend(struct device *dev)