[PATCH] elx: efct: fix zalloc-simple.cocci warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: kbuild test robot <lkp@xxxxxxxxx>

Use zeroing allocator rather than allocator followed by memset with 0

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

CC: James Smart <jsmart2021@xxxxxxxxx>
Signed-off-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: Julia Lawall <julia.lawall@xxxxxxxx>
---

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

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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux