From: Peter Wang Date: Thu, 28 Mar 2024 11:12:44 +0000 (+0800) Subject: scsi: ufs: core: Fix MCQ mode dev command timeout X-Git-Tag: v6.6.31~187 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85bb85801910ff73db3d8cb7d0be2777b715fbae;p=thirdparty%2Fkernel%2Fstable.git scsi: ufs: core: Fix MCQ mode dev command timeout [ Upstream commit 2a26a11e9c258b14be6fd98f8a85f20ac1fff66e ] When a dev command times out in MCQ mode, a successfully cleared command should cause a retry. However, because we currently return 0, the caller considers the command a success which causes the following error to be logged: "Invalid offset 0x0 in descriptor IDN 0x9, length 0x0". Retry if clearing the command was successful. Signed-off-by: Peter Wang Link: https://lore.kernel.org/r/20240328111244.3599-1-peter.wang@mediatek.com Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 8005373e20bae..344806330be16 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -3064,7 +3064,9 @@ retry: /* 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; }