Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730332 > unrolled thread

[PATCH] scsi: qla2xxx: remove unnecessary call to memset

Started byHimanshu Jha <himanshujha199640@gmail.com>
First post2017-09-11 15:00 +0200
Last post2017-09-11 15:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] scsi: qla2xxx: remove unnecessary call to memset Himanshu Jha <himanshujha199640@gmail.com> - 2017-09-11 15:00 +0200

#1730332 — [PATCH] scsi: qla2xxx: remove unnecessary call to memset

FromHimanshu Jha <himanshujha199640@gmail.com>
Date2017-09-11 15:00 +0200
Subject[PATCH] scsi: qla2xxx: remove unnecessary call to memset
Message-ID<uowtI-3p8-21@gated-at.bofh.it>
call to memset to assign 0 value immediately after allocating
memory with kzalloc is unnecesaary as kzalloc allocates the memory
filled with 0 value.

Semantic patch used to resolve this issue:

@@
expression e,e2; constant c;
statement S;
@@

  e = kzalloc(e2, c);
  if(e == NULL) S
- memset(e, 0, e2);

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/scsi/qla2xxx/qla_init.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index b5b48dd..54c1d63 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -7917,7 +7917,6 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos,
 			    "Failed to allocate memory for queue pair.\n");
 			return NULL;
 		}
-		memset(qpair, 0, sizeof(struct qla_qpair));
 
 		qpair->hw = vha->hw;
 		qpair->vha = vha;
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web