[PATCH 2/2] regmap: cache: Don't attempt to sync non-writeable registers.

From: Dylan Reid
Date: Tue Mar 18 2014 - 16:51:53 EST


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@xxxxxxxxxxxx>
---
drivers/base/regmap/regcache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 44af125..29b4128 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -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);
--
1.8.1.3.605.g02339dd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/