2020-04-21 12:26:09

by Zou Wei

[permalink] [raw]
Subject: [PATCH -next] scsi: aic7xxx: fix kzalloc-simple.cocci warnings

This patch fixes below warning reported by coccicheck

drivers/scsi/aic7xxx/aic7xxx_core.c:4387:7-14: WARNING: kzalloc
should be used for ahc, instead of kmalloc/memset

Fixes: 48813cf989eb ("[SCSI] aic7xxx: Remove OS utility wrappers")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zou Wei <[email protected]>
---
drivers/scsi/aic7xxx/aic7xxx_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 84fc499..999de19 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -4384,13 +4384,12 @@ ahc_alloc(void *platform_arg, char *name)
struct ahc_softc *ahc;
int i;

- ahc = kmalloc(sizeof(*ahc), GFP_ATOMIC);
+ ahc = kzalloc(sizeof(*ahc), GFP_ATOMIC);
if (!ahc) {
printk("aic7xxx: cannot malloc softc!\n");
kfree(name);
return NULL;
}
- memset(ahc, 0, sizeof(*ahc));
ahc->seep_config = kmalloc(sizeof(*ahc->seep_config), GFP_ATOMIC);
if (ahc->seep_config == NULL) {
kfree(ahc);
--
2.6.2