Skip to content

Commit

Permalink
scsi: ufs: core: Fix another deadlock during RTC update
Browse files Browse the repository at this point in the history
If ufshcd_rtc_work calls ufshcd_rpm_put_sync() and the pm's usage_count
is 0, we will enter the runtime suspend callback.  However, the runtime
suspend callback will wait to flush ufshcd_rtc_work, causing a deadlock.

Replace ufshcd_rpm_put_sync() with ufshcd_rpm_put() to avoid the
deadlock.

Fixes: 6bf999e ("scsi: ufs: core: Add UFS RTC support")
Cc: [email protected] #6.11.x
Signed-off-by: Peter Wang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
ptr324 authored and martinkpetersen committed Oct 25, 2024
1 parent d28d17a commit cb7e509
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ufs/core/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8219,7 +8219,7 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)

err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
0, 0, &val);
ufshcd_rpm_put_sync(hba);
ufshcd_rpm_put(hba);

if (err)
dev_err(hba->dev, "%s: Failed to update rtc %d\n", __func__, err);
Expand Down

0 comments on commit cb7e509

Please sign in to comment.