* [PATCH] dmaengine: qcom: hidma_mgmt: fix autosuspend cleanup on probe failure
@ 2026-08-08 11:20 Guangshuo Li
2026-09-30 20:35 ` Frank Li
0 siblings, 1 reply; 3+ messages in thread
From: Guangshuo Li @ 2026-08-08 11:20 UTC (permalink / raw)
To: Sinan Kaya, Vinod Koul, Frank Li, Andy Shevchenko,
linux-arm-kernel, linux-arm-msm, dmaengine, linux-kernel
Cc: Guangshuo Li, stable
hidma_mgmt_probe() calls pm_runtime_use_autosuspend(), but its failure
path does not call the matching pm_runtime_dont_use_autosuspend()
before disabling runtime PM.
If the autosuspend delay is set to a negative value while autosuspend
is enabled, the runtime PM core increments usage_count to prevent
runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
during cleanup, this reference is not dropped and usage_count remains
unbalanced.
Add the missing pm_runtime_dont_use_autosuspend() call to the probe
failure path before disabling runtime PM.
This issue was found by manual code inspection.
Fixes: 7f8f209fd6e0 ("dmaengine: add Qualcomm Technologies HIDMA management driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/dma/qcom/hidma_mgmt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
index 4805ce390ffa..470c88f36d25 100644
--- a/drivers/dma/qcom/hidma_mgmt.c
+++ b/drivers/dma/qcom/hidma_mgmt.c
@@ -168,7 +168,11 @@ static int hidma_mgmt_probe(struct platform_device *pdev)
pm_runtime_set_autosuspend_delay(&pdev->dev, HIDMA_AUTOSUSPEND_TIMEOUT);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
+
+ rc = devm_pm_runtime_enable(&pdev->dev);
+ if (rc)
+ return rc;
+
pm_runtime_get_sync(&pdev->dev);
virtaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
@@ -310,7 +314,6 @@ static int hidma_mgmt_probe(struct platform_device *pdev)
return 0;
out:
pm_runtime_put_sync_suspend(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
return rc;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] dmaengine: qcom: hidma_mgmt: fix autosuspend cleanup on probe failure
2026-08-08 11:20 [PATCH] dmaengine: qcom: hidma_mgmt: fix autosuspend cleanup on probe failure Guangshuo Li
@ 2026-09-30 20:35 ` Frank Li
2026-10-07 11:27 ` Guangshuo Li
0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2026-09-30 20:35 UTC (permalink / raw)
To: Guangshuo Li
Cc: Sinan Kaya, Vinod Koul, Frank Li, Andy Shevchenko,
linux-arm-kernel, linux-arm-msm, dmaengine, linux-kernel, stable
On Sat, Aug 08, 2026 at 07:20:43PM +0800, Guangshuo Li wrote:
> hidma_mgmt_probe() calls pm_runtime_use_autosuspend(), but its failure
> path does not call the matching pm_runtime_dont_use_autosuspend()
> before disabling runtime PM.
>
> If the autosuspend delay is set to a negative value while autosuspend
> is enabled, the runtime PM core increments usage_count to prevent
> runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
> during cleanup, this reference is not dropped and usage_count remains
> unbalanced.
>
> Add the missing pm_runtime_dont_use_autosuspend() call to the probe
> failure path before disabling runtime PM.
>
> This issue was found by manual code inspection.
Your descripption doesn't match your patch. You change change pm_runtime_enable()
to devm_pm_runtime_enable()
Frank
>
> Fixes: 7f8f209fd6e0 ("dmaengine: add Qualcomm Technologies HIDMA management driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> drivers/dma/qcom/hidma_mgmt.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
> index 4805ce390ffa..470c88f36d25 100644
> --- a/drivers/dma/qcom/hidma_mgmt.c
> +++ b/drivers/dma/qcom/hidma_mgmt.c
> @@ -168,7 +168,11 @@ static int hidma_mgmt_probe(struct platform_device *pdev)
> pm_runtime_set_autosuspend_delay(&pdev->dev, HIDMA_AUTOSUSPEND_TIMEOUT);
> pm_runtime_use_autosuspend(&pdev->dev);
> pm_runtime_set_active(&pdev->dev);
> - pm_runtime_enable(&pdev->dev);
> +
> + rc = devm_pm_runtime_enable(&pdev->dev);
> + if (rc)
> + return rc;
> +
> pm_runtime_get_sync(&pdev->dev);
>
> virtaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> @@ -310,7 +314,6 @@ static int hidma_mgmt_probe(struct platform_device *pdev)
> return 0;
> out:
> pm_runtime_put_sync_suspend(&pdev->dev);
> - pm_runtime_disable(&pdev->dev);
> return rc;
> }
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] dmaengine: qcom: hidma_mgmt: fix autosuspend cleanup on probe failure
2026-09-30 20:35 ` Frank Li
@ 2026-10-07 11:27 ` Guangshuo Li
0 siblings, 0 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-10-07 11:27 UTC (permalink / raw)
To: Frank Li
Cc: Sinan Kaya, Vinod Koul, Frank Li, Andy Shevchenko,
linux-arm-kernel, linux-arm-msm, dmaengine, linux-kernel, stable
Hi Frank,
Thanks for the review.
On Thu, 1 Oct 2026 at 04:35, Frank Li <Frank.li@oss.nxp.com> wrote:
>
> On Sat, Aug 08, 2026 at 07:20:43PM +0800, Guangshuo Li wrote:
> > hidma_mgmt_probe() calls pm_runtime_use_autosuspend(), but its failure
> > path does not call the matching pm_runtime_dont_use_autosuspend()
> > before disabling runtime PM.
> >
> > If the autosuspend delay is set to a negative value while autosuspend
> > is enabled, the runtime PM core increments usage_count to prevent
> > runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
> > during cleanup, this reference is not dropped and usage_count remains
> > unbalanced.
> >
> > Add the missing pm_runtime_dont_use_autosuspend() call to the probe
> > failure path before disabling runtime PM.
> >
> > This issue was found by manual code inspection.
>
> Your descripption doesn't match your patch. You change change pm_runtime_enable()
> to devm_pm_runtime_enable()
>
> Frank
>
> >
> > Fixes: 7f8f209fd6e0 ("dmaengine: add Qualcomm Technologies HIDMA management driver")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> > ---
> > drivers/dma/qcom/hidma_mgmt.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
> > index 4805ce390ffa..470c88f36d25 100644
> > --- a/drivers/dma/qcom/hidma_mgmt.c
> > +++ b/drivers/dma/qcom/hidma_mgmt.c
> > @@ -168,7 +168,11 @@ static int hidma_mgmt_probe(struct platform_device *pdev)
> > pm_runtime_set_autosuspend_delay(&pdev->dev, HIDMA_AUTOSUSPEND_TIMEOUT);
> > pm_runtime_use_autosuspend(&pdev->dev);
> > pm_runtime_set_active(&pdev->dev);
> > - pm_runtime_enable(&pdev->dev);
> > +
> > + rc = devm_pm_runtime_enable(&pdev->dev);
> > + if (rc)
> > + return rc;
> > +
> > pm_runtime_get_sync(&pdev->dev);
> >
> > virtaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> > @@ -310,7 +314,6 @@ static int hidma_mgmt_probe(struct platform_device *pdev)
> > return 0;
> > out:
> > pm_runtime_put_sync_suspend(&pdev->dev);
> > - pm_runtime_disable(&pdev->dev);
> > return rc;
> > }
> >
> > --
> > 2.43.0
> >
You are right, the description of the patch does not match the actual
change. This was my mistake.
The patch tried to address the missing autosuspend cleanup, but
instead of adding the explicit pm_runtime_dont_use_autosuspend() call
in the error path, it switched to devm_pm_runtime_enable(). This made
the implementation and the commit message inconsistent.
I will prepare and send a v2 patch with the fix matching the description.
Thanks again for catching this.
Best regards,
Guangshuo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-07 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 11:20 [PATCH] dmaengine: qcom: hidma_mgmt: fix autosuspend cleanup on probe failure Guangshuo Li
2026-09-30 20:35 ` Frank Li
2026-10-07 11:27 ` Guangshuo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox