summaryrefslogtreecommitdiff
path: root/drivers/ufs/core/ufshcd.c
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2024-10-16 13:12:07 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2024-10-25 15:30:22 -0400
commitb92e5937e3523b0b7d41373681256bec78d7e134 (patch)
treeeb47f52821488c1949aceaf572383d8e99821afd /drivers/ufs/core/ufshcd.c
parent72e979225ed2e9427396e317d33050bcf50ad899 (diff)
downloadlwn-b92e5937e3523b0b7d41373681256bec78d7e134.tar.gz
lwn-b92e5937e3523b0b7d41373681256bec78d7e134.zip
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 <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>
Diffstat (limited to 'drivers/ufs/core/ufshcd.c')
-rw-r--r--drivers/ufs/core/ufshcd.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index fd2783623a89..099373a25017 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -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,