All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing
@ 2020-12-30  1:37 ` Zheng Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Zheng Yongjun @ 2020-12-30  1:37 UTC (permalink / raw)
  To: rmfrfs, johan, elder, gregkh, devel, linux-kernel; +Cc: Zheng Yongjun

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 | 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),
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing
@ 2020-12-30  1:37 ` Zheng Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Zheng Yongjun @ 2020-12-30  1:37 UTC (permalink / raw)
  To: rmfrfs, johan, elder, gregkh, devel, linux-kernel; +Cc: Zheng Yongjun

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 | 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),
-- 
2.22.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing
  2020-12-30  1:37 ` Zheng Yongjun
@ 2020-12-30  3:33   ` Alex Elder
  -1 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2020-12-30  3:33 UTC (permalink / raw)
  To: Zheng Yongjun, rmfrfs, johan, elder, gregkh, devel, linux-kernel

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@huawei.com>

Looks good.

Reviewed-by: Alex Elder <elder@linaro.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),
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing
@ 2020-12-30  3:33   ` Alex Elder
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2020-12-30  3:33 UTC (permalink / raw)
  To: Zheng Yongjun, rmfrfs, johan, elder, gregkh, devel, linux-kernel

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@huawei.com>

Looks good.

Reviewed-by: Alex Elder <elder@linaro.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),
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing
  2020-12-30  1:37 ` Zheng Yongjun
@ 2020-12-30 10:13   ` Rui Miguel Silva
  -1 siblings, 0 replies; 6+ messages in thread
From: Rui Miguel Silva @ 2020-12-30 10:13 UTC (permalink / raw)
  To: Zheng Yongjun; +Cc: johan, elder, gregkh, devel, linux-kernel

Hi Yongjun,
many thanks for your patch.

On Wed, Dec 30, 2020 at 09:37:06AM +0800, 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>

Like Alex said, LGTM also.

Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>

------
Cheers,
     Rui
> ---
>  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),
> -- 
> 2.22.0
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing
@ 2020-12-30 10:13   ` Rui Miguel Silva
  0 siblings, 0 replies; 6+ messages in thread
From: Rui Miguel Silva @ 2020-12-30 10:13 UTC (permalink / raw)
  To: Zheng Yongjun; +Cc: devel, gregkh, elder, johan, linux-kernel

Hi Yongjun,
many thanks for your patch.

On Wed, Dec 30, 2020 at 09:37:06AM +0800, 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>

Like Alex said, LGTM also.

Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>

------
Cheers,
     Rui
> ---
>  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),
> -- 
> 2.22.0
> 
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-30 10:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30  1:37 [PATCH v2 -next] staging: greybus: light: Use kzalloc for allocating only one thing Zheng Yongjun
2020-12-30  1:37 ` Zheng Yongjun
2020-12-30  3:33 ` Alex Elder
2020-12-30  3:33   ` Alex Elder
2020-12-30 10:13 ` Rui Miguel Silva
2020-12-30 10:13   ` Rui Miguel Silva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.