]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: core: Move two statements
authorBart Van Assche <bvanassche@acm.org>
Fri, 31 Oct 2025 20:39:10 +0000 (13:39 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Nov 2025 22:02:30 +0000 (17:02 -0500)
Move two statements that will be needed for pseudo SCSI devices in front
of code that won't be needed for pseudo SCSI devices. No functionality
has been changed.

Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251031204029.2883185-3-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_scan.c

index 3c6e089e80c383fbeaa170d0a2e7174ec3117be9..de039efef290cc40e48b307cb1835e7f3eae2930 100644 (file)
@@ -347,6 +347,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
        kref_get(&sdev->host->tagset_refcnt);
        sdev->request_queue = q;
 
+       scsi_sysfs_device_initialize(sdev);
+
        depth = sdev->host->cmd_per_lun ?: 1;
 
        /*
@@ -363,8 +365,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 
        scsi_change_queue_depth(sdev, depth);
 
-       scsi_sysfs_device_initialize(sdev);
-
        if (shost->hostt->sdev_init) {
                ret = shost->hostt->sdev_init(sdev);
                if (ret) {
@@ -1068,6 +1068,8 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 
        transport_configure_device(&sdev->sdev_gendev);
 
+       sdev->sdev_bflags = *bflags;
+
        /*
         * No need to freeze the queue as it isn't reachable to anyone else yet.
         */
@@ -1113,7 +1115,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 
        sdev->max_queue_depth = sdev->queue_depth;
        WARN_ON_ONCE(sdev->max_queue_depth > sdev->budget_map.depth);
-       sdev->sdev_bflags = *bflags;
 
        /*
         * Ok, the device is now all set up, we can