CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: James Smart <[email protected]>
CC: [email protected]
CC: [email protected], [email protected], [email protected], [email protected], 
[email protected], [email protected], [email protected], James Smart 
<[email protected]>, Ram Vegesna <[email protected]>

From: kbuild test robot <[email protected]>

drivers/scsi/elx/efct/efct_xport.c:44:9-16: WARNING: kzalloc should be used for 
xport, instead of kmalloc/memset
drivers/scsi/elx/efct/efct_xport.c:688:12-19: WARNING: kzalloc should be used 
for payload, instead of kmalloc/memset


 Use zeroing allocator rather than allocator followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

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

CC: James Smart <[email protected]>
Signed-off-by: kbuild test robot <[email protected]>
---

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;
 
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to