Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636912

[PATCH] Staging: greybus: Prefer kcalloc over kzalloc

From karthik@techveda.org
Newsgroups linux.kernel
Subject [PATCH] Staging: greybus: Prefer kcalloc over kzalloc
Date 2017-05-06 16:20 +0200
Message-ID <tE8IV-G4-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Karthik Tummala <karthik@techveda.org>

Fixed following checkpatch.pl warning:
 * WARNING: Prefer kcalloc over kzalloc with multiply

Instead of specifying no.of bytes * size as arugment
in kzalloc, prefer kcalloc.

Signed-off-by: Karthik Tummala <karthik@techveda.org>
---
 drivers/staging/greybus/light.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index 1681362..861a249 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -1030,7 +1030,7 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id)
 	light->channels_count = conf.channel_count;
 	light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL);
 
-	light->channels = kzalloc(light->channels_count *
+	light->channels = kcalloc(light->channels_count,
 				  sizeof(struct gb_channel), GFP_KERNEL);
 	if (!light->channels)
 		return -ENOMEM;
@@ -1167,7 +1167,7 @@ static int gb_lights_create_all(struct gb_lights *glights)
 	if (ret < 0)
 		goto out;
 
-	glights->lights = kzalloc(glights->lights_count *
+	glights->lights = kcalloc(glights->lights_count,
 				  sizeof(struct gb_light), GFP_KERNEL);
 	if (!glights->lights) {
 		ret = -ENOMEM;
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] Staging: greybus: Prefer kcalloc over kzalloc karthik@techveda.org - 2017-05-06 16:20 +0200
  Re: [PATCH] Staging: greybus: Prefer kcalloc over kzalloc Rui Miguel Silva <rmfrfs@gmail.com> - 2017-05-08 12:40 +0200
    [PATCH v2] Staging: greybus: light: Prefer kcalloc over kzalloc karthik@techveda.org - 2017-05-08 14:40 +0200
      Re: [greybus-dev] [PATCH v2] Staging: greybus: light: Prefer kcalloc  over kzalloc Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-09 07:40 +0200

csiph-web