Skip to contentSkip to conversation

block: Use kcalloc instead of kzalloc to initialize array

PATCH In review Helen Fornazier 2 participants 3 messages Mar 26, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Use kcalloc instead of kzalloc to initialize array

This patch fixes checkpatch.pl warning:

WARNING: Prefer kcalloc over kzalloc with multiply
+ bio_slabs = kzalloc(bio_slab_max * sizeof(struct bio_slab), GFP_KERNEL);

---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/bio.c +1 -1
index f66a4ea..7495017 100644
@@ -2051,7 +2051,7 @@ static int __init init_bio(void)
 {
 	bio_slab_max = 2;
 	bio_slab_nr = 0;
-	bio_slabs = kzalloc(bio_slab_max * sizeof(struct bio_slab), GFP_KERNEL);
+	bio_slabs = kcalloc(bio_slab_max, sizeof(struct bio_slab), GFP_KERNEL);
 	if (!bio_slabs)
 		panic("bio: can't allocate bios\n");
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 9 lines · Helen Fornazier

This patch fixes checkpatch.pl warning:

WARNING: Prefer kcalloc over kzalloc with multiply
+ bio_slabs = kzalloc(bio_slab_max * sizeof(struct bio_slab), GFP_KERNEL);

---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

The outreachy application process can only accept patches made in drivers/staging/* so there's nothing I can do with these block patches, sorry.

greg k-h

#2 lore raw
Quoted 12 lines · Greg KH
Quoted 4 lines · Helen Fornazier

This patch fixes checkpatch.pl warning:

WARNING: Prefer kcalloc over kzalloc with multiply
+ bio_slabs = kzalloc(bio_slab_max * sizeof(struct bio_slab),

GFP_KERNEL);

Quoted 5 lines
---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines

The outreachy application process can only accept patches made in drivers/staging/* so there's nothing I can do with these block patches, sorry.

greg k-h

No problem, I suspected about it after I sent the patches.

Signature · 1 line
Helen Fornazier