scsi: ufs: core: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()
authorBart Van Assche <bvanassche@acm.org>
Mon, 18 Dec 2023 22:52:15 +0000 (14:52 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Jan 2024 04:03:05 +0000 (23:03 -0500)
Calling ufshcd_hba_exit() from a function that is called asynchronously
from ufshcd_init() is wrong because this triggers multiple race
conditions. Instead of calling ufshcd_hba_exit(), log an error message.

Reported-by: Daniel Mentz <danielmentz@google.com>
Fixes: 1d337ec2f35e ("ufs: improve init sequence")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20231218225229.2542156-3-bvanassche@acm.org
Reviewed-by: Can Guo <quic_cang@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index 0ad8bde39cd1912880622e0b153532ee9aec2aa7..7c59d7a02243ecc7c92c4fc236caca70e04a1381 100644 (file)
@@ -8982,12 +8982,9 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
 
 out:
        pm_runtime_put_sync(hba->dev);
-       /*
-        * If we failed to initialize the device or the device is not
-        * present, turn off the power/clocks etc.
-        */
+
        if (ret)
-               ufshcd_hba_exit(hba);
+               dev_err(hba->dev, "%s failed: %d\n", __func__, ret);
 }
 
 static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)