scsi: ufs: skip shutdown if hba is not powered
authorStanley Chu <stanley.chu@mediatek.com>
Wed, 18 Sep 2019 04:20:38 +0000 (12:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2019 08:14:55 +0000 (09:14 +0100)
commitea8a6a585aa5ec4bbd37dc14ad882633644d5136
tree2f9cc8c30547d1683ed7270454322bc1f3383ddb
parent364ef83db0273acc89c6ba8ae1aebee70a133056
scsi: ufs: skip shutdown if hba is not powered

[ Upstream commit f51913eef23f74c3bd07899dc7f1ed6df9e521d8 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/ufs/ufshcd.c