summaryrefslogtreecommitdiffstats
path: root/drivers/ufs/core/ufshcd.c
diff options
context:
space:
mode:
authorPeter Wang <peter.wang@mediatek.com>2024-03-28 19:12:44 +0800
committerMartin K. Petersen <martin.petersen@oracle.com>2024-04-01 21:43:46 -0400
commit2a26a11e9c258b14be6fd98f8a85f20ac1fff66e (patch)
treecfe24f44fa07439071051ddee89dadfb6550b67e /drivers/ufs/core/ufshcd.c
parente675a4fd6d1f8990d3bed5dada3d20edfa000423 (diff)
downloadlinux-stable-2a26a11e9c258b14be6fd98f8a85f20ac1fff66e.tar.gz
linux-stable-2a26a11e9c258b14be6fd98f8a85f20ac1fff66e.tar.bz2
linux-stable-2a26a11e9c258b14be6fd98f8a85f20ac1fff66e.zip
scsi: ufs: core: Fix MCQ mode dev command timeout
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 <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20240328111244.3599-1-peter.wang@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs/core/ufshcd.c')
-rw-r--r--drivers/ufs/core/ufshcd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 292b06f361a2..a0f8e930167d 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3217,7 +3217,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;
}