From 1767da9e8e9a1dc1416d6bb1029b8cf5659dac2a Mon Sep 17 00:00:00 2001 From: Ionut Nicu Date: Fri, 9 Aug 2013 12:09:15 +0200 Subject: [PATCH] regmap: fix regcache_reg_present() for empty cache In the initial case when no reg_defaults values are provided and no register value was added to the cache yet, the cache_present bitmap is NULL. If this function is invoked for any register it should return false (i.e. the register is not cached) instead of true. Signed-off-by: Ionut Nicu Signed-off-by: Mark Brown --- drivers/base/regmap/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 29c83160ca29..5308e3e870ba 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -223,7 +223,7 @@ int regcache_set_reg_present(struct regmap *map, unsigned int reg); static inline bool regcache_reg_present(struct regmap *map, unsigned int reg) { if (!map->cache_present) - return true; + return false; if (reg > map->cache_present_nbits) return false; return map->cache_present[BIT_WORD(reg)] & BIT_MASK(reg);