ANDROID: fix android-specific bug in ufshcd.c

There is a circular locking dependency bug detected that
only occurs in ACK and not in upstream.
According to the discussed solution, use mutex_trylock
instead of mutex_lock.

Fixes: e97633492f5a ("scsi: ufs: core: Don't perform UFS clkscaling during host async scan")
Link: https://lore.kernel.org/all/20250522081233.2358565-1-quic_ziqichen@quicinc.com/
Bug: 436163342
Change-Id: Ibc231d385b0695e0d2863d8606eb0ab8a15550c1
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
This commit is contained in:
Peter Wang
2025-08-08 13:50:27 +08:00
committed by Sandeep Dhavale
parent c46482c03a
commit 8ff877aa63
+3 -1
View File
@@ -1436,7 +1436,9 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba, u64 timeout_us)
* make sure that there are no outstanding requests when
* clock scaling is in progress
*/
mutex_lock(&hba->host->scan_mutex);
if (!mutex_trylock(&hba->host->scan_mutex))
return -EAGAIN;
blk_mq_quiesce_tagset(&hba->host->tag_set);
mutex_lock(&hba->wb_mutex);
down_write(&hba->clk_scaling_lock);