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_hw_queues.c:173:7-14: WARNING: kzalloc should be 
used for cq, instead of kmalloc/memset
drivers/scsi/elx/efct/efct_hw_queues.c:376:7-14: WARNING: kzalloc should be 
used for rq, 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_hw_queues.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/scsi/elx/efct/efct_hw_queues.c
+++ b/drivers/scsi/elx/efct/efct_hw_queues.c
@@ -170,11 +170,10 @@ efct_hw_new_cq_set(struct hw_eq *eqs[],
                cqs[i] = NULL;
 
        for (i = 0; i < num_cqs; i++) {
-               cq = kmalloc(sizeof(*cq), GFP_KERNEL);
+               cq = kzalloc(sizeof(*cq), GFP_KERNEL);
                if (!cq)
                        goto error;
 
-               memset(cq, 0, sizeof(*cq));
                cqs[i]          = cq;
                cq->eq          = eqs[i];
                cq->type        = SLI_QTYPE_CQ;
@@ -373,11 +372,10 @@ efct_hw_new_rq_set(struct hw_cq *cqs[],
                rqs[i] = NULL;
 
        for (i = 0, q_count = 0; i < num_rq_pairs; i++, q_count += 2) {
-               rq = kmalloc(sizeof(*rq), GFP_KERNEL);
+               rq = kzalloc(sizeof(*rq), GFP_KERNEL);
                if (!rq)
                        goto error;
 
-               memset(rq, 0, sizeof(*rq));
                rqs[i] = rq;
                rq->instance = hw->hw_rq_count++;
                rq->cq = cqs[i];
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to