* [PATCH v1] scsi: ufs: Change the error check sequence for auto hibern8
[not found] <CGME20261021052403epcas2p43e1a022f46314c1a9d1ffb66502c29eb@epcas2p4.samsung.com>
@ 2026-10-21 5:19 ` HOYOUNG SEO
2026-10-21 5:35 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: HOYOUNG SEO @ 2026-10-21 5:19 UTC (permalink / raw)
To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
martin.petersen, bvanassche, kwangwon.min, kwmad.kim, cpgs,
h10.kim
Cc: HOYOUNG SEO
In the case of auto hibern8, hibern8 entering or exiting occurs
without a cmd, so it is not correct to check
for the presence of a cmd before checking for auto hibern8 errors.
Thus, the order of the auto hibern8 error check changed.
Signed-off-by: HOYOUNG SEO <hy50.seo@samsung.com>
---
drivers/ufs/core/ufshcd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index bcc2512bf34b..c8a70d7d210d 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -5928,6 +5928,9 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
struct uic_command *cmd;
guard(spinlock_irqsave)(&hba->host->host_lock);
+ if (ufshcd_is_auto_hibern8_error(hba, intr_status))
+ hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
+
cmd = hba->active_uic_cmd;
if (!cmd) {
dev_err(hba->dev,
@@ -5935,9 +5938,6 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
return retval;
}
- if (ufshcd_is_auto_hibern8_error(hba, intr_status))
- hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
-
if (intr_status & UIC_COMMAND_COMPL) {
/*
* Store the UIC command result in the lowest byte of
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] scsi: ufs: Change the error check sequence for auto hibern8
2026-10-21 5:19 ` [PATCH v1] scsi: ufs: Change the error check sequence for auto hibern8 HOYOUNG SEO
@ 2026-10-21 5:35 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-21 5:35 UTC (permalink / raw)
To: HOYOUNG SEO, linux-scsi
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] scsi: ufs: fallthrough after auto hibern8 error in ufshcd_uic_cmd_compl()
--
commit 5bb3d85e5945c6dc3a3a1bb37e02acd5c7703a06
Author: HOYOUNG SEO <hy50.seo@samsung.com>
scsi: ufs: Change the error check sequence for auto hibern8
This commit moves the ufshcd_is_auto_hibern8_error() check in
ufshcd_uic_cmd_compl() ahead of the active_uic_cmd check so that
auto-hibern8 errors are recorded even when no UIC command is active.
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index cc75384c65021..e15b08488187f 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -5928,6 +5928,9 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
> struct uic_command *cmd;
>
> guard(spinlock_irqsave)(&hba->host->host_lock);
> + if (ufshcd_is_auto_hibern8_error(hba, intr_status))
> + hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
> +
> cmd = hba->active_uic_cmd;
> if (!cmd) {
> dev_err(hba->dev,
> @@ -5935,9 +5938,6 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
> return retval;
> }
>
> - if (ufshcd_is_auto_hibern8_error(hba, intr_status))
> - hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
> -
> if (intr_status & UIC_COMMAND_COMPL) {
> /*
> * Store the UIC command result in the lowest byte of
[Severity: Medium]
When ufshcd_is_auto_hibern8_error() returns true in ufshcd_uic_cmd_compl(),
execution still falls through after setting hba->errors:
drivers/ufs/core/ufshcd.c:ufshcd_uic_cmd_compl() {
...
if (ufshcd_is_auto_hibern8_error(hba, intr_status))
hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
cmd = hba->active_uic_cmd;
if (!cmd) {
dev_err(hba->dev,
"No active UIC command. Maybe a timeout occurred?\n");
return retval;
}
...
if (intr_status & UFSHCD_UIC_PWR_MASK && hba->uic_async_done) {
cmd->cmd_active = false;
complete(hba->uic_async_done);
retval = IRQ_HANDLED;
}
...
}
In the normal auto-hibern8 case where no UIC command is active
(hba->active_uic_cmd is NULL), won't falling through to the !cmd check
always log a misleading "No active UIC command. Maybe a timeout occurred?"
error and return IRQ_NONE?
Also, if an asynchronous UIC command such as UIC_CMD_DME_SET is active with
hba->uic_async_done set when an auto-hibern8 error interrupt arrives,
UFSHCD_UIC_PWR_MASK includes UFSHCD_UIC_HIBERN8_MASK. Could falling through
with UFSHCD_UIC_HIBERN8_MASK still set in intr_status prematurely complete
hba->uic_async_done?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021051951.1687479-1-hy50.seo@samsung.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-21 5:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261021052403epcas2p43e1a022f46314c1a9d1ffb66502c29eb@epcas2p4.samsung.com>
2026-10-21 5:19 ` [PATCH v1] scsi: ufs: Change the error check sequence for auto hibern8 HOYOUNG SEO
2026-10-21 5:35 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox