Commit 6500966d authored by Zheng Yongjun's avatar Zheng Yongjun Committed by Greg Kroah-Hartman

staging: greybus: light: Use kzalloc for allocating only one thing

Use kzalloc rather than kcalloc(1,...)

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarZheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201230013706.28698-1-zhengyongjun3@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1f82c332
...@@ -290,8 +290,7 @@ static int channel_attr_groups_set(struct gb_channel *channel, ...@@ -290,8 +290,7 @@ static int channel_attr_groups_set(struct gb_channel *channel,
channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL); channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL);
if (!channel->attrs) if (!channel->attrs)
return -ENOMEM; return -ENOMEM;
channel->attr_group = kcalloc(1, sizeof(*channel->attr_group), channel->attr_group = kzalloc(sizeof(*channel->attr_group), GFP_KERNEL);
GFP_KERNEL);
if (!channel->attr_group) if (!channel->attr_group)
return -ENOMEM; return -ENOMEM;
channel->attr_groups = kcalloc(2, sizeof(*channel->attr_groups), channel->attr_groups = kcalloc(2, sizeof(*channel->attr_groups),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment