Skip to content

Commit

Permalink
scsi: ufs: skip shutdown if hba is not powered
Browse files Browse the repository at this point in the history
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.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Stanley Chu authored and Martin K. Petersen committed Sep 24, 2019
1 parent c9c5374 commit f51913e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8140,6 +8140,9 @@ int ufshcd_shutdown(struct ufs_hba *hba)
{
int ret = 0;

if (!hba->is_powered)
goto out;

if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
goto out;

Expand Down

0 comments on commit f51913e

Please sign in to comment.