[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a0d265-f9b3-dbc6-edff-396c5a354f92@acm.org>
Date: Thu, 27 Oct 2022 13:39:56 -0700
From: Bart Van Assche <bvanassche@....org>
To: keosung.park@...sung.com, ALIM AKHTAR <alim.akhtar@...sung.com>,
"avri.altman@....com" <avri.altman@....com>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"beanhuo@...ron.com" <beanhuo@...ron.com>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
Jinyoung CHOI <j-young.choi@...sung.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] scsi: ufs: core: Use 'else' in ufshcd_hba_enable()
On 10/26/22 23:20, Keoseong Park wrote:
> Convert if (!ret) { ... } if (ret) { ... } into
> if (!ret) { ... } else { ... }.
>
> Signed-off-by: Keoseong Park <keosung.park@...sung.com>
> ---
> drivers/ufs/core/ufshcd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 7256e6c43ca6..3b794be53287 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4670,7 +4670,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
> ret = ufshcd_dme_enable(hba);
> if (!ret)
> ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);
> - if (ret)
> + else
> dev_err(hba->dev,
> "Host controller enable failed with non-hce\n");
> }
If ufshcd_hba_enable() is modified it should be converted into the widely
used "if error return" style. How about the untested patch below?
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 05feec10fad3..89f8b86c3f85 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4668,14 +4668,16 @@ 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);
}
Powered by blists - more mailing lists