regmap: cache: Don't attempt to sync non-writeable registers
authorDylan Reid <dgreid@chromium.org>
Tue, 18 Mar 2014 20:45:09 +0000 (13:45 -0700)
committerMark Brown <broonie@linaro.org>
Wed, 19 Mar 2014 10:38:56 +0000 (10:38 +0000)
In the regcache_default_sync, if a register isn't writeable, then
_regmap_write will return an error and the rest of the sync will be
aborted.  Avoid this by checking if a register is writeable before
trying to sync it.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/base/regmap/regcache.c

index bb3ba42e032983e1afc5e763dc06d22389af163b..a9d8d7be6aa31cb79ee066a247e24e11e7271395 100644 (file)
@@ -253,7 +253,8 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
                unsigned int val;
                int ret;
 
-               if (regmap_volatile(map, reg))
+               if (regmap_volatile(map, reg) ||
+                   !regmap_writeable(map, reg))
                        continue;
 
                ret = regcache_read(map, reg, &val);