1
0
Fork 0

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 <ioan.nicu.ext@nsn.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
hifive-unleashed-5.1
Ionut Nicu 2013-08-09 12:09:15 +02:00 committed by Mark Brown
parent c095ba7224
commit 1767da9e8e
1 changed files with 1 additions and 1 deletions

View File

@ -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);