Commit c6d91bd3 authored by Stanley Chu's avatar Stanley Chu Committed by Greg Kroah-Hartman

scsi: ufs: skip shutdown if hba is not powered

[ Upstream commit f51913ee ]

In some cases, hba may go through shutdown flow without successful
initialization and then make system hang.

For example, if ufshcd_change_power_mode() gets error and leads to
ufshcd_hba_exit() to release resources of the host, future shutdown flow
may hang the system since the host register will be accessed in unpowered
state.

To solve this issue, simply add checking to skip shutdown for above kind of
situation.

Link: https://lore.kernel.org/r/1568780438-28753-1-git-send-email-stanley.chu@mediatek.comSigned-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Acked-by: default avatarBean Huo <beanhuo@micron.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent db783e05
...@@ -7874,6 +7874,9 @@ int ufshcd_shutdown(struct ufs_hba *hba) ...@@ -7874,6 +7874,9 @@ int ufshcd_shutdown(struct ufs_hba *hba)
{ {
int ret = 0; int ret = 0;
if (!hba->is_powered)
goto out;
if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment