Re: [PATCH] usb: chipidea: fix usage_count leak when autosuspend_delay is negative
From: Frank Li
Date: Thu Jul 16 2026 - 08:44:09 EST
On Thu, Jul 16, 2026 at 06:41:26PM +0800, Xu Yang wrote:
> From: Xu Yang <xu.yang_2@xxxxxxx>
>
> The probe() calls pm_runtime_use_autosuspend(), but remove() does not call
> pm_runtime_dont_use_autosuspend(). This can lead to a usage_count leak if
> autosuspend_delay is set to a negative value.
>
> The pm_runtime_use_autosuspend() also notes that it's important to undo
> this with pm_runtime_dont_use_autosuspend() at driver exit time.
>
> Fixes: 1f874edcb731 ("usb: chipidea: add runtime power management support")
> Assisted-by: Claude:claude-sonnet-4.6
> Signed-off-by: Xu Yang <xu.yang_2@xxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/usb/chipidea/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 7edc512cc37d..3461dd763a6e 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -1250,6 +1250,7 @@ static void ci_hdrc_remove(struct platform_device *pdev)
> usb_role_switch_unregister(ci->role_switch);
>
> if (ci->supports_runtime_pm) {
> + pm_runtime_dont_use_autosuspend(&pdev->dev);
> pm_runtime_get_sync(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
> pm_runtime_put_noidle(&pdev->dev);
> --
> 2.34.1
>
>