Skip to content

Commit

Permalink
staging: greybus: light: Use kzalloc for allocating only one thing
Browse files Browse the repository at this point in the history
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: Alex Elder <[email protected]>
Reviewed-by: Rui Miguel Silva <[email protected]>
Signed-off-by: Zheng Yongjun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Zheng Yongjun authored and gregkh committed Jan 5, 2021
1 parent 1f82c33 commit 6500966
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/greybus/light.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ static int channel_attr_groups_set(struct gb_channel *channel,
channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL);
if (!channel->attrs)
return -ENOMEM;
channel->attr_group = kcalloc(1, sizeof(*channel->attr_group),
GFP_KERNEL);
channel->attr_group = kzalloc(sizeof(*channel->attr_group), GFP_KERNEL);
if (!channel->attr_group)
return -ENOMEM;
channel->attr_groups = kcalloc(2, sizeof(*channel->attr_groups),
Expand Down

0 comments on commit 6500966

Please sign in to comment.