diff mbox series

[v2] scsi: elx: efct: Avoid a useless memset

Message ID 9be7d5beb437583f8d975d168ac5c3e32fb6e465.1639158677.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Deferred
Headers show
Series [v2] scsi: elx: efct: Avoid a useless memset | expand

Commit Message

Christophe JAILLET Dec. 10, 2021, 5:53 p.m. UTC
'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
statement.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v1 --> v2: s/kzalloc/kcalloc/

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

Patch

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) {
 			efct_io_pool_free(io_pool);
 			return NULL;
 		}
 
-		memset(io->sgl, 0, sizeof(*io->sgl) * num_sgl);
 		io->sgl_allocated = num_sgl;
 		io->sgl_count = 0;