summaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regcache-flat.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/regmap/regcache-flat.c')
-rw-r--r--drivers/base/regmap/regcache-flat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c
index 3ee72550b1e3..4d2e50bfc726 100644
--- a/drivers/base/regmap/regcache-flat.c
+++ b/drivers/base/regmap/regcache-flat.c
@@ -27,7 +27,7 @@ static int regcache_flat_init(struct regmap *map)
int i;
unsigned int *cache;
- if (!map || map->reg_stride_order < 0)
+ if (!map || map->reg_stride_order < 0 || !map->max_register)
return -EINVAL;
map->cache = kcalloc(regcache_flat_get_index(map, map->max_register)