Re: [PATCH] scsi: ufs: core: Keep clock-gating hold on failed W-LUN runtime resume

From: Peter Wang

Date: Tue Nov 03 2026 - 22:57:34 EST


On Thu, 2026-10-29 at 15:08 +0800, Stanley Jhu wrote:
> 1. __ufshcd_wl_suspend() takes one ufshcd_hold() reference and sets
>    hba->clk_gating.is_suspended while the UFS device W-LUN enters
>    RPM_SUSPENDED.
> 2. Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on
>    suspend callback failures"), a failed runtime resume (for example
>    START STOP UNIT completing with an error) leaves the W-LUN in
>    RPM_SUSPENDED with power.runtime_error == 0, while
>    __ufshcd_wl_resume() already clears hba->clk_gating.is_suspended
> and
>    calls ufshcd_release().
> 3. The next W-LUN runtime resume runs __ufshcd_wl_resume() again
> without
>    an intervening suspend and calls ufshcd_release() a second time,
>    dropping a reference it does not own and underflowing
>    hba->clk_gating.active_reqs on UFSHCD_CAP_CLK_GATING hosts.
>
> Keep hba->clk_gating.is_suspended and the suspend hold across a
> failed
> W-LUN runtime resume, so the hold stays paired with the W-LUN
> RPM_SUSPENDED state and the next successful resume releases it.
>
> Fixes: eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend
> callback failures")
> Cc: stable@xxxxxxxxxxxxxxx # v7.3+
> Signed-off-by: Stanley Jhu <stanleyjhu@xxxxxxxxxx>
> ---

Reviewed-by: Peter Wang <peter.wang@xxxxxxxxxxxx>