]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: ufs: core: Move code out of an if-statement
authorBart Van Assche <bvanassche@acm.org>
Wed, 16 Oct 2024 20:12:07 +0000 (13:12 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Oct 2024 19:30:22 +0000 (15:30 -0400)
The previous patch in this series introduced identical code in both
branches of an if-statement. Move that code outside the if-statement.

Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241016201249.2256266-12-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index fd2783623a89790a3629d44c0764b267833c7213..099373a25017c563569cdfb7f2f46ded528d3360 100644 (file)
@@ -10356,26 +10356,20 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba)
                        dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
                                err);
                }
-               err = scsi_add_host(hba->host, hba->dev);
-               if (err) {
-                       dev_err(hba->dev, "scsi_add_host failed\n");
-                       return err;
-               }
-               hba->scsi_host_added = true;
-       } else {
-               if (!hba->lsdb_sup) {
-                       dev_err(hba->dev,
-                               "%s: failed to initialize (legacy doorbell mode not supported)\n",
-                               __func__);
-                       return -EINVAL;
-               }
-               err = scsi_add_host(hba->host, hba->dev);
-               if (err) {
-                       dev_err(hba->dev, "scsi_add_host failed\n");
-                       return err;
-               }
-               hba->scsi_host_added = true;
        }
+       if (!is_mcq_supported(hba) && !hba->lsdb_sup) {
+               dev_err(hba->dev,
+                       "%s: failed to initialize (legacy doorbell mode not supported)\n",
+                       __func__);
+               return -EINVAL;
+       }
+
+       err = scsi_add_host(hba->host, hba->dev);
+       if (err) {
+               dev_err(hba->dev, "scsi_add_host failed\n");
+               return err;
+       }
+       hba->scsi_host_added = true;
 
        hba->tmf_tag_set = (struct blk_mq_tag_set) {
                .nr_hw_queues   = 1,