mfd: arizona: Clean up on failed runtime resume

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>
This commit is contained in:
Mark Brown 2013-01-14 15:50:38 +09:00 committed by Samuel Ortiz
parent 1816cb3409
commit 4816bd1c6d
1 changed files with 7 additions and 4 deletions

View File

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