All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings
Date: Sun, 12 Apr 2020 15:22:54 +0800	[thread overview]
Message-ID: <20200412072254.GA18884@9dbb232d854f> (raw)
In-Reply-To: <202004121504.E6ItoFUo%lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2336 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200412033303.29574-32-jsmart2021@gmail.com>
References: <20200412033303.29574-32-jsmart2021@gmail.com>
TO: James Smart <jsmart2021@gmail.com>
CC: linux-scsi(a)vger.kernel.org
CC: dwagner(a)suse.de, maier(a)linux.ibm.com, bvanassche(a)acm.org, herbszt(a)gmx.de, natechancellor(a)gmail.com, rdunlap(a)infradead.org, hare(a)suse.de, James Smart <jsmart2021@gmail.com>, Ram Vegesna <ram.vegesna@broadcom.com>

From: kbuild test robot <lkp@intel.com>

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 <jsmart2021@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

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

  parent reply	other threads:[~2020-04-12  7:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12  7:22 [PATCH v3 31/31] elx: efct: Tie into kernel Kconfig and build process kbuild test robot
2020-04-12  7:22 ` [PATCH] elx: efct: fix zalloc-simple.cocci warnings kbuild test robot
2020-04-12  7:22 ` kbuild test robot [this message]
2020-04-12  7:22 ` kbuild test robot
2020-04-12  7:22 ` kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-04-12 15:33 Julia Lawall
2020-04-12 15:38 Julia Lawall
2020-04-12 15:38 ` Julia Lawall
2020-04-12 15:39 Julia Lawall
2020-04-12 15:39 ` Julia Lawall
2020-04-12 15:40 Julia Lawall
2020-04-12 15:40 ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200412072254.GA18884@9dbb232d854f \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.