Skip to content

Commit b92e593

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Move code out of an if-statement
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 <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 72e9792 commit b92e593

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10356,26 +10356,20 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba)
1035610356
dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
1035710357
err);
1035810358
}
10359-
err = scsi_add_host(hba->host, hba->dev);
10360-
if (err) {
10361-
dev_err(hba->dev, "scsi_add_host failed\n");
10362-
return err;
10363-
}
10364-
hba->scsi_host_added = true;
10365-
} else {
10366-
if (!hba->lsdb_sup) {
10367-
dev_err(hba->dev,
10368-
"%s: failed to initialize (legacy doorbell mode not supported)\n",
10369-
__func__);
10370-
return -EINVAL;
10371-
}
10372-
err = scsi_add_host(hba->host, hba->dev);
10373-
if (err) {
10374-
dev_err(hba->dev, "scsi_add_host failed\n");
10375-
return err;
10376-
}
10377-
hba->scsi_host_added = true;
1037810359
}
10360+
if (!is_mcq_supported(hba) && !hba->lsdb_sup) {
10361+
dev_err(hba->dev,
10362+
"%s: failed to initialize (legacy doorbell mode not supported)\n",
10363+
__func__);
10364+
return -EINVAL;
10365+
}
10366+
10367+
err = scsi_add_host(hba->host, hba->dev);
10368+
if (err) {
10369+
dev_err(hba->dev, "scsi_add_host failed\n");
10370+
return err;
10371+
}
10372+
hba->scsi_host_added = true;
1037910373

1038010374
hba->tmf_tag_set = (struct blk_mq_tag_set) {
1038110375
.nr_hw_queues = 1,

0 commit comments

Comments
 (0)