summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorJeongtae Park <jtp.park@samsung.com>2022-04-25 20:46:11 +0900
committerMark Brown <broonie@kernel.org>2022-04-25 14:00:44 +0100
commitd640947562cea6158df13fe021b0e117865ba8b3 (patch)
tree5c831691d37a195d0a1425d6744059727577d22c /drivers/base
parentbd941dfaae3503c6b707d8544696205f759e57a3 (diff)
downloadlinux-d640947562cea6158df13fe021b0e117865ba8b3.tar.bz2
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index f2469d3435ca..d0f5bc827978 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -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",