Skip to contentSkip to conversation

scsi: ufs: skip shutdown if hba is not powered

PATCH Applied Stanley Chu 3 participants 3 messages Sep 18, 2019 – Sep 24, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: skip shutdown if hba is not powered

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.

---
 drivers/scsi/ufs/ufshcd.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/ufs/ufshcd.c +3 -0
index 60a24fe908e7..a601ce0f6195 100644
@@ -8121,6 +8121,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;
 
Signature · 1 line
2.18.0
#2 lore raw
In reply to Stanley Chu

Stanley,

Quoted 2 lines

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

Applied to 5.4/scsi-fixes, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering