diff mbox series

[v4,09/10] scsi: ufs: core: Move code out of an if-statement

Message ID 20240905220214.738506-10-bvanassche@acm.org
State Superseded
Headers show
Series Simplify the UFS driver initialization code | expand

Commit Message

Bart Van Assche Sept. 5, 2024, 10:01 p.m. UTC
The previous patch in this series introduced identical code in both
branches of an if-statement. Move that code outside the if-statement.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

Comments

Bao D. Nguyen Sept. 7, 2024, 8:36 p.m. UTC | #1
On 9/5/2024 3:01 PM, Bart Van Assche wrote:
> The previous patch in this series introduced identical code in both
> branches of an if-statement. Move that code outside the if-statement.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index b46e9b526839..17615b56e83e 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10391,21 +10391,15 @@  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 {
-		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;
 	}
 
+	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,
 		.queue_depth	= hba->nutmrs,