[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-driver-devel
Subject: Re: [PATCH -next] staging: greybus: light: Use kzalloc for allocating only one thing
From: Alex Elder <elder () ieee ! org>
Date: 2020-12-29 13:54:47
Message-ID: 0b38c99d-badd-7a86-2026-5e2ff783ad98 () ieee ! org
[Download RAW message or body]
On 12/29/20 7:50 AM, 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@huawei.com>
> ---
> drivers/staging/greybus/light.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index d2672b65c3f4..d227382fca20 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -290,7 +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),
> + channel->attr_group = kzalloc(sizeof(*channel->attr_group),
> GFP_KERNEL);
Looks good but that shortens the line enough to avoid a line wrap.
Please send v2 with GFP_KERNEL on the same line as the kzalloc()
call.
-Alex
> if (!channel->attr_group)
> return -ENOMEM;
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic