Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: James Smart <jsmart2021@gmail.com>
Cc: linux-scsi@vger.kernel.org, dwagner@suse.de, maier@linux.ibm.com,
	bvanassche@acm.org, herbszt@gmx.de, natechancellor@gmail.com,
	rdunlap@infradead.org, hare@suse.de,
	James Smart <jsmart2021@gmail.com>,
	Ram Vegesna <ram.vegesna@broadcom.com>,
	kbuild-all@lists.01.org
Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings
Date: Sun, 12 Apr 2020 17:40:22 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2004121739210.2419@hadrien> (raw)

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

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


             reply	other threads:[~2020-04-12 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12 15:40 Julia Lawall [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-04-12 15:39 [PATCH] elx: efct: fix zalloc-simple.cocci warnings Julia Lawall
2020-04-12 15:38 Julia Lawall
2020-04-12 15:33 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=alpine.DEB.2.21.2004121739210.2419@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=bvanassche@acm.org \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=herbszt@gmx.de \
    --cc=jsmart2021@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=maier@linux.ibm.com \
    --cc=natechancellor@gmail.com \
    --cc=ram.vegesna@broadcom.com \
    --cc=rdunlap@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox