diff mbox

[26/31] scsi: Move the code for clearing private command data into scsi_dispatch_cmd()

Message ID 20170524003420.5381-27-bart.vanassche@sandisk.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Bart Van Assche May 24, 2017, 12:34 a.m. UTC
This patch does not change any functionality but avoids duplication
of the code for clearing driver-private command data.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/scsi_lib.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Hannes Reinecke May 24, 2017, 6:12 a.m. UTC | #1
On 05/24/2017 02:34 AM, Bart Van Assche wrote:
> This patch does not change any functionality but avoids duplication
> of the code for clearing driver-private command data.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/scsi_lib.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 12fd2bb0fe9c..f131964ecb51 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1339,7 +1339,6 @@  static int scsi_prep_fn(struct request_queue *q, struct request *req)
 			goto out;
 		}
 
-		memset(scsi_cmd_priv(cmd), 0, dev->host->hostt->cmd_size);
 		scsi_add_cmd_to_list(cmd);
 		req->special = cmd;
 	}
@@ -1677,6 +1676,8 @@  static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 
 	}
 
+	memset(scsi_cmd_priv(cmd), 0, host->hostt->cmd_size);
+
 	trace_scsi_dispatch_cmd_start(cmd);
 	rtn = host->hostt->queuecommand(host, cmd);
 	if (rtn) {
@@ -1863,8 +1864,6 @@  static int scsi_mq_prep_fn(struct request *req)
 	struct Scsi_Host *shost = sdev->host;
 	struct scatterlist *sg;
 
-	memset(scsi_cmd_priv(cmd), 0, shost->hostt->cmd_size);
-
 	req->special = cmd;
 
 	cmd->request = req;