From: Bart Van Assche <bvanassche@acm.org>
To: keosung.park@samsung.com, ALIM AKHTAR <alim.akhtar@samsung.com>,
"avri.altman@wdc.com" <avri.altman@wdc.com>,
"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"beanhuo@micron.com" <beanhuo@micron.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
Jinyoung CHOI <j-young.choi@samsung.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scsi: ufs: core: Use 'else' in ufshcd_hba_enable()
Date: Thu, 27 Oct 2022 13:39:56 -0700 [thread overview]
Message-ID: <87a0d265-f9b3-dbc6-edff-396c5a354f92@acm.org> (raw)
In-Reply-To: <20221027062013epcms2p7af8fbc60caaba50686233492fb3dfd93@epcms2p7>
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@samsung.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);
}
next prev parent reply other threads:[~2022-10-27 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20221027062013epcms2p7af8fbc60caaba50686233492fb3dfd93@epcms2p7>
2022-10-27 6:20 ` Keoseong Park
2022-10-27 20:39 ` Bart Van Assche [this message]
2022-10-28 0:05 ` Keoseong Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a0d265-f9b3-dbc6-edff-396c5a354f92@acm.org \
--to=bvanassche@acm.org \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=j-young.choi@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=keosung.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®