[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f374b9d0-4020-1c63-2c81-53e963ee182e@linaro.org>
Date: Tue, 29 Dec 2020 21:33:29 -0600
From: Alex Elder <elder@...aro.org>
To: Zheng Yongjun <zhengyongjun3@...wei.com>, rmfrfs@...il.com,
johan@...nel.org, elder@...nel.org, gregkh@...uxfoundation.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 -next] staging: greybus: light: Use kzalloc for
allocating only one thing
On 12/29/20 7:37 PM, Zheng Yongjun wrote:
> 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>
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@...wei.com>
Looks good.
Reviewed-by: Alex Elder <elder@...aro.org>
> ---
> drivers/staging/greybus/light.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index d2672b65c3f4..87d36948c610 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -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),
>
Powered by blists - more mailing lists