summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/regmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 74225361fd..809f58489f 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -30,8 +30,9 @@ DECLARE_GLOBAL_DATA_PTR;
static struct regmap *regmap_alloc(int count)
{
struct regmap *map;
+ size_t size = sizeof(*map) + sizeof(map->ranges[0]) * count;
- map = malloc(sizeof(*map) + sizeof(map->ranges[0]) * count);
+ map = calloc(1, size);
if (!map)
return NULL;
map->range_count = count;