All of
 help / color / mirror / Atom feed
From: Christophe JAILLET <>
	Christophe JAILLET <>
Subject: [PATCH v2] scsi: elx: efct: Avoid a useless memset
Date: Fri, 10 Dec 2021 18:53:35 +0100	[thread overview]
Message-ID: <> (raw)

'io->sgl' is kzalloced just a few lines above. There is no need to memset
it another time.

While at it change a kzalloc into an equivalent kcalloc to increase the
semantic and avoid an open coded arithmetic in a memory allocation

Signed-off-by: Christophe JAILLET <>
v1 --> v2: s/kzalloc/kcalloc/

 drivers/scsi/elx/efct/efct_io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/elx/efct/efct_io.c b/drivers/scsi/elx/efct/efct_io.c
index 71e21655916a..109483f3e3df 100644
--- a/drivers/scsi/elx/efct/efct_io.c
+++ b/drivers/scsi/elx/efct/efct_io.c
@@ -56,13 +56,12 @@ efct_io_pool_create(struct efct *efct, u32 num_sgl)
 		/* Allocate SGL */
-		io->sgl = kzalloc(sizeof(*io->sgl) * num_sgl, GFP_KERNEL);
+		io->sgl = kcalloc(num_sgl, sizeof(*io->sgl), GFP_KERNEL);
 		if (!io->sgl) {
 			return NULL;
-		memset(io->sgl, 0, sizeof(*io->sgl) * num_sgl);
 		io->sgl_allocated = num_sgl;
 		io->sgl_count = 0;

                 reply	other threads:[~2021-12-10 17:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \

* 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.