Staging: greybus: Prefer kcalloc over kzalloc
Subsystems (3)
PATCH 1/1 Staging: greybus: Prefer kcalloc over kzalloc
From: Karthik Tummala <[email protected]>
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.
--- drivers/staging/greybus/light.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/light.c +2 -2
@@ -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 ;
Signature · 1 line
1.9.1
Hi Karthik,
Thanks for the patch.
Quoted 9 lines · On Sat, May 06, 2017 at 07:44:10PM +0530, [email protected] wrote:
From: Karthik Tummala <[email protected]>
Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiplyInstead of specifying no.of bytes * size as arugment in kzalloc, prefer kcalloc.
Signed-off-by Karthik Tummala <[email protected]>
Can you send a v2 with a subject similar to the other commits in the file. i.e, starting with staging: greybus: light: ...
And you have a typo in the change log s/arugment/argument/.
If this two are fixed, you can add my:
Cheers,
Rui
Quoted 29 lines
---
drivers/staging/greybus/light.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/greybus/light.c +2
-2@@ -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 ;Signature · 1 line
1.9.1
PATCH v2 1/1 Staging: greybus: light: Prefer kcalloc over kzalloc
From: Karthik Tummala <[email protected]>
Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiply
Instead of specifying no.of bytes * size as argument in kzalloc, prefer kcalloc.
---
Changes for v2:
- Changed subject line & fixed typo as suggested by Rui Miguel Silva
--- drivers/staging/greybus/light.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/light.c +2 -2
@@ -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 ;
Signature · 1 line
1.9.1
Re: [greybus-dev] [PATCH v2] Staging: greybus: light: Prefer kcalloc over kzalloc
Quoted 32 lines · On 08-05-17, 18:05, [email protected] wrote:
From: Karthik Tummala <[email protected]>
Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiplyInstead of specifying no.of bytes * size as argument in kzalloc, prefer kcalloc.
Signed-off-by Karthik Tummala <[email protected]>Reviewed-by Rui Miguel Silva <[email protected]>---
Changes for v2:
- Changed subject line & fixed typo as suggested by Rui Miguel Silva--- drivers/staging/greybus/light.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/greybus/light.c +1
-1@@ -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 ;
drivers/staging/greybus/light.c static int gb_lights_create_all(struct gb_lights *glights) · line 1173
Quoted 8 lines
drivers/staging/greybus/light.c +1
-1@@ -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 ;
Signature · 1 line
viresh