mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 02:15:02 +00:00
regmap: zero out the regmap on allocation
Some fields will be introduced in the regmap structure that should be set to 0 by default. So, once we allocate a regmap, make sure it is zeroed out to avoid unexpected defaults for those values. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
ffb22f6b84
commit
97d8a6970a
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue