scsi: ufs: core: Refactor ufshcd_hba_enable()

Message ID 20221028073553epcms2p6dc4f8bdbebdc8f96f43fc4197b3edd0c@epcms2p6
State New
Headers
Series scsi: ufs: core: Refactor ufshcd_hba_enable() |

Commit Message

Keoseong Park Oct. 28, 2022, 7:35 a.m. UTC
  Use "if error return" style in ufshcd_hba_enable().
No functional change.

Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
---
 drivers/ufs/core/ufshcd.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
  

Comments

Bart Van Assche Oct. 28, 2022, 10:37 p.m. UTC | #1
On 10/28/22 00:35, Keoseong Park wrote:
> Use "if error return" style in ufshcd_hba_enable().
> No functional change.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
  
Martin K. Petersen Nov. 8, 2022, 2:56 a.m. UTC | #2
Keoseong,

> Use "if error return" style in ufshcd_hba_enable().  No functional
> change.

Applied to 6.2/scsi-staging, thanks!
  
Martin K. Petersen Nov. 17, 2022, 6:29 p.m. UTC | #3
On Fri, 28 Oct 2022 16:35:53 +0900, Keoseong Park wrote:

> Use "if error return" style in ufshcd_hba_enable().
> No functional change.
> 
> 

Applied to 6.2/scsi-queue, thanks!

[1/1] scsi: ufs: core: Refactor ufshcd_hba_enable()
      https://git.kernel.org/mkp/scsi/c/bc77fb9ce40c
  

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index b2203dd79e8c..4288241040db 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4665,14 +4665,18 @@  int ufshcd_hba_enable(struct ufs_hba *hba)
 		/* enable UIC related interrupts */
 		ufshcd_enable_intr(hba, UFSHCD_UIC_MASK);
 		ret = ufshcd_dme_reset(hba);
-		if (!ret) {
-			ret = ufshcd_dme_enable(hba);
-			if (!ret)
-				ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);
-			if (ret)
-				dev_err(hba->dev,
-					"Host controller enable failed with non-hce\n");
+		if (ret) {
+			dev_err(hba->dev, "DME_RESET failed\n");
+			return ret;
 		}
+
+		ret = ufshcd_dme_enable(hba);
+		if (ret) {
+			dev_err(hba->dev, "Enabling DME failed\n");
+			return ret;
+		}
+
+		ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);
 	} else {
 		ret = ufshcd_hba_execute_hce(hba);
 	}