regmap: cache: set max_register with reg_stride

Current logic does not consider multi-stride cases,
the max_register have to calculate with reg_stride
because it is a kind of address range.

Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
Link: https://lore.kernel.org/r/20220425114613.15934-1-jtp.park@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jeongtae Park 2022-04-25 20:46:11 +09:00 committed by Mark Brown
parent bd941dfaae
commit d640947562
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 2 additions and 2 deletions

View File

@ -183,8 +183,8 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
return 0;
}
if (!map->max_register)
map->max_register = map->num_reg_defaults_raw;
if (!map->max_register && map->num_reg_defaults_raw)
map->max_register = (map->num_reg_defaults_raw - 1) * map->reg_stride;
if (map->cache_ops->init) {
dev_dbg(map->dev, "Initializing %s cache\n",