Skip to content

Commit

Permalink
regmap: fix regcache_reg_present() for empty cache
Browse files Browse the repository at this point in the history
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 <ioan.nicu.ext@nsn.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Ionut Nicu authored and Mark Brown committed Aug 9, 2013
1 parent c095ba7 commit 1767da9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/regmap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1767da9

Please sign in to comment.