diff mbox series

elx: efct: fix zalloc-simple.cocci warnings

Message ID alpine.DEB.2.21.2004121739210.2419@hadrien (mailing list archive)
State Not Applicable
Headers show
Series elx: efct: fix zalloc-simple.cocci warnings | expand

Commit Message

Julia Lawall April 12, 2020, 3:40 p.m. UTC
From: kbuild test robot <lkp@intel.com>

Use zeroing allocator rather than allocator followed by memset with 0

Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci

CC: James Smart <jsmart2021@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

url:    https://github.com/0day-ci/linux/commits/James-Smart/efct-Broadcom-Emulex-FC-Target-driver/20200412-114125
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago

 efct_xport.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

--- a/drivers/scsi/elx/efct/efct_xport.c
+++ b/drivers/scsi/elx/efct/efct_xport.c
@@ -41,11 +41,10 @@  efct_xport_alloc(struct efct *efct)
 {
 	struct efct_xport *xport;

-	xport = kmalloc(sizeof(*xport), GFP_KERNEL);
+	xport = kzalloc(sizeof(*xport), GFP_KERNEL);
 	if (!xport)
 		return xport;

-	memset(xport, 0, sizeof(*xport));
 	xport->efct = efct;
 	return xport;
 }
@@ -685,12 +684,10 @@  efct_xport_control(struct efct_xport *xp
 		context = va_arg(argp, void *);
 		va_end(argp);

-		payload = kmalloc(sizeof(*payload), GFP_KERNEL);
+		payload = kzalloc(sizeof(*payload), GFP_KERNEL);
 		if (!payload)
 			return EFC_FAIL;

-		memset(payload, 0, sizeof(*payload));
-
 		efct = node->efc->base;
 		hw = &efct->hw;