From: Elise Lennion <elise.lennion@gmail.com>
To: vaibhav.sr@gmail.com, johan@kernel.org, elder@kernel.org,
gregkh@linuxfoundation.org, outreachy-kernel@googlegroups.com
Subject: [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation.
Date: Tue, 11 Oct 2016 00:16:14 -0300 [thread overview]
Message-ID: <20161011031614.GA22058@lennorien.com> (raw)
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
next reply other threads:[~2016-10-11 3:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-11 3:16 Elise Lennion [this message]
2016-10-12 13:22 ` [PATCH 6/7] staging: greybus: Use kcalloc for array's memory allocation Greg KH
2016-10-12 17:23 ` Elise Lennion
-- strict thread matches above, loose matches on Subject: below --
2016-10-11 3:14 Elise Lennion
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161011031614.GA22058@lennorien.com \
--to=elise.lennion@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=vaibhav.sr@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.