diff options
author | Stanley Chu <stanley.chu@mediatek.com> | 2019-09-18 12:20:38 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-29 09:19:29 +0100 |
commit | c6d91bd3fa35fb85ffbcaeb6f6ff332da13f8923 (patch) | |
tree | 5433a3eb37cfd312785c87117b4a59fd1eb4e9ee /drivers/scsi/ufs | |
parent | db783e05df551f48580b2b08965716a1368ac53a (diff) | |
download | linux-stable-c6d91bd3fa35fb85ffbcaeb6f6ff332da13f8923.tar.gz linux-stable-c6d91bd3fa35fb85ffbcaeb6f6ff332da13f8923.tar.bz2 linux-stable-c6d91bd3fa35fb85ffbcaeb6f6ff332da13f8923.zip |
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>
Diffstat (limited to 'drivers/scsi/ufs')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b8b59cfeacd1..4aaba3e03055 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7874,6 +7874,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; |