diff mbox series

[-next] scsi: aic7xxx: fix kzalloc-simple.cocci warnings

Message ID 1587472207-105095-1-git-send-email-zou_wei@huawei.com (mailing list archive)
State Not Applicable
Headers show
Series [-next] scsi: aic7xxx: fix kzalloc-simple.cocci warnings | expand

Commit Message

Zou Wei April 21, 2020, 12:30 p.m. UTC
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 <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

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);