提交 97d8a697 编写于 作者: P Pratyush Yadav 提交者: Tom Rini

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: NPratyush Yadav <p.yadav@ti.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 ffb22f6b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册