On 2020-11-16 11:04, Bart Van Assche wrote:
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@xxxxxxxxxx>
Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Cc: Can Guo <cang@xxxxxxxxxxxxxx>
Cc: Stanley Chu <stanley.chu@xxxxxxxxxxxx>
Cc: Ming Lei <ming.lei@xxxxxxxxxx>
Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
Reviewed-by: Can Guo <cang@xxxxxxxxxxxxxx>
---
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)