All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation.
@ 2016-10-11  3:14 Elise Lennion
  0 siblings, 0 replies; 4+ messages in thread
From: Elise Lennion @ 2016-10-11  3:14 UTC (permalink / raw)
  To: johan, elder, gregkh, outreachy-kernel

Fix checkpatch warning:

WARNING: Prefer kcalloc over kzalloc with multiply

kcalloc is designed to allocate memory for arrays, its use is
preferable than kzalloc in these cases.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---
 drivers/staging/greybus/camera.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index 0c73445..1c5b41a 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -797,7 +797,7 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams,
 	if (gb_nstreams > GB_CAMERA_MAX_STREAMS)
 		return -EINVAL;
 
-	gb_streams = kzalloc(gb_nstreams * sizeof(*gb_streams), GFP_KERNEL);
+	gb_streams = kcalloc(gb_nstreams, sizeof(*gb_streams), GFP_KERNEL);
 	if (!gb_streams)
 		return -ENOMEM;
 
@@ -938,7 +938,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 		return ret;
 
 	/* For each stream to configure parse width, height and format */
-	streams = kzalloc(nstreams * sizeof(*streams), GFP_KERNEL);
+	streams = kcalloc(nstreams, sizeof(*streams), GFP_KERNEL);
 	if (!streams)
 		return -ENOMEM;
 
-- 
2.7.4



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

* [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation.
@ 2016-10-11  3:16 Elise Lennion
  2016-10-12 13:22 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Elise Lennion @ 2016-10-11  3:16 UTC (permalink / raw)
  To: vaibhav.sr, johan, elder, gregkh, outreachy-kernel

Fix checkpatch warning:

WARNING: Prefer kcalloc over kzalloc with multiply

kcalloc is designed to allocate memory for arrays, its use is
preferable than kzalloc in these cases.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---
 drivers/staging/greybus/camera.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index 0c73445..1c5b41a 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -797,7 +797,7 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams,
 	if (gb_nstreams > GB_CAMERA_MAX_STREAMS)
 		return -EINVAL;
 
-	gb_streams = kzalloc(gb_nstreams * sizeof(*gb_streams), GFP_KERNEL);
+	gb_streams = kcalloc(gb_nstreams, sizeof(*gb_streams), GFP_KERNEL);
 	if (!gb_streams)
 		return -ENOMEM;
 
@@ -938,7 +938,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 		return ret;
 
 	/* For each stream to configure parse width, height and format */
-	streams = kzalloc(nstreams * sizeof(*streams), GFP_KERNEL);
+	streams = kcalloc(nstreams, sizeof(*streams), GFP_KERNEL);
 	if (!streams)
 		return -ENOMEM;
 
-- 
2.7.4



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

* Re: [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation.
  2016-10-11  3:16 Elise Lennion
@ 2016-10-12 13:22 ` Greg KH
  2016-10-12 17:23   ` Elise Lennion
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-10-12 13:22 UTC (permalink / raw)
  To: Elise Lennion; +Cc: vaibhav.sr, johan, elder, outreachy-kernel

On Tue, Oct 11, 2016 at 12:16:14AM -0300, Elise Lennion wrote:
> Fix checkpatch warning:
> 
> WARNING: Prefer kcalloc over kzalloc with multiply
> 
> kcalloc is designed to allocate memory for arrays, its use is
> preferable than kzalloc in these cases.
> 
> Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
> ---
>  drivers/staging/greybus/camera.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Same issue with the subject:, it's the same as the previous patch.

A way to make it more unique would be to add the driver name to it, so
for this one, it would be:
	staging: greybus: camera: use kcalloc for array's memory

thanks,

greg k-h


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

* Re: [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation.
  2016-10-12 13:22 ` Greg KH
@ 2016-10-12 17:23   ` Elise Lennion
  0 siblings, 0 replies; 4+ messages in thread
From: Elise Lennion @ 2016-10-12 17:23 UTC (permalink / raw)
  To: Greg KH; +Cc: vaibhav.sr, johan, elder, outreachy-kernel

> 
> Same issue with the subject:, it's the same as the previous patch.
> 
> A way to make it more unique would be to add the driver name to it, so
> for this one, it would be:
> 	staging: greybus: camera: use kcalloc for array's memory
> 

New version of the patch:
https://groups.google.com/forum/#!topic/outreachy-kernel/C6QYYyoxzP8


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

end of thread, other threads:[~2016-10-12 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-11  3:14 [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation Elise Lennion
  -- strict thread matches above, loose matches on Subject: below --
2016-10-11  3:16 Elise Lennion
2016-10-12 13:22 ` Greg KH
2016-10-12 17:23   ` Elise Lennion

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.