diff mbox series

[v1] ufs: core: fix mcq mode dev commad timeout

Message ID 20240328111244.3599-1-peter.wang@mediatek.com
State New
Headers show
Series [v1] ufs: core: fix mcq mode dev commad timeout | expand

Commit Message

Peter Wang (王信友) March 28, 2024, 11:12 a.m. UTC
From: Peter Wang <peter.wang@mediatek.com>

When dev command timeout in mcq mode, clear success should return
retry, because return 0, caller consider success and have error log.
"Invalid offset 0x0 in descriptor IDN 0x9, length 0x0"

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
 drivers/ufs/core/ufshcd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen April 2, 2024, 1:48 a.m. UTC | #1
On Thu, 28 Mar 2024 19:12:44 +0800, peter.wang@mediatek.com wrote:

> When dev command timeout in mcq mode, clear success should return
> retry, because return 0, caller consider success and have error log.
> "Invalid offset 0x0 in descriptor IDN 0x9, length 0x0"
> 
> 

Applied to 6.9/scsi-fixes, thanks!

[1/1] ufs: core: fix mcq mode dev commad timeout
      https://git.kernel.org/mkp/scsi/c/2a26a11e9c25
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index e30fd125988d..5f8749ea347c 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3217,7 +3217,9 @@  static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
 
 		/* MCQ mode */
 		if (is_mcq_enabled(hba)) {
-			err = ufshcd_clear_cmd(hba, lrbp->task_tag);
+			/* successfully cleared the command, retry if needed */
+			if (ufshcd_clear_cmd(hba, lrbp->task_tag) == 0)
+				err = -EAGAIN;
 			hba->dev_cmd.complete = NULL;
 			return err;
 		}