[PATCH v2 4/9] scsi: Rework scsi_mq_alloc_queue()

Bart Van Assche
2020-11-16T03:05:30Z

Do not modify sdev->request_queue. Remove the sdev->request_queue
assignment. That assignment is superfluous because scsi_mq_alloc_queue()
only has one caller and that caller calls scsi_mq_alloc_queue() as follows:

sdev->request_queue = scsi_mq_alloc_queue(sdev);

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Can Guo <cang@codeaurora.org>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_lib.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e4f9ed355be6..ff480fa6261e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1883,14 +1883,15 @@ static const struct blk_mq_ops scsi_mq_ops = {

struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
{
- sdev->request_queue = blk_mq_init_queue(&sdev->host->tag_set);
- if (IS_ERR(sdev->request_queue))
+ struct request_queue *q = blk_mq_init_queue(&sdev->host->tag_set);
+
+ if (IS_ERR(q))
return NULL;

- sdev->request_queue->queuedata = sdev;
- __scsi_init_queue(sdev->host, sdev->request_queue);
- blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, sdev->request_queue);
- return sdev->request_queue;
+ q->queuedata = sdev;
+ __scsi_init_queue(sdev->host, q);
+ blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, q);
+ return q;
}

int scsi_mq_setup_tags(struct Scsi_Host *shost)