]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: fix broken hba->outstanding_tasks
authorStanley Chu <stanley.chu@mediatek.com>
Mon, 19 Aug 2019 13:43:28 +0000 (21:43 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 29 Aug 2019 21:47:23 +0000 (17:47 -0400)
commit11c9df3511286e8f91e7bacc91110ad6870a7529
tree0ccfab85356297a0f1dee056f97bd10ddd9398e6
parent18e64a55251c96b83d795ab3eb61ad559054c2fd
scsi: ufs: fix broken hba->outstanding_tasks

Currently bits in hba->outstanding_tasks are cleared only after their
corresponding task management commands are successfully done by
__ufshcd_issue_tm_cmd().

If timeout happens in a task management command, its corresponding bit in
hba->outstanding_tasks will not be cleared until next task management
command with the same tag used successfully finishes.

This is wrong and can lead to some issues, like power issue.  For example,
ufshcd_release() and ufshcd_gate_work() will do nothing if
hba->outstanding_tasks is not zero even if both UFS host and devices are
actually idle.

Solution is referred from error handling of device commands: bits in
hba->outstanding_tasks shall be cleared regardless of their execution
results.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c