Re: [PATCH v2] dmaengine: qcom_hidma: Fix runtime PM leak in hidma_issue_task()

From: Frank Li

Date: Mon Nov 16 2026 - 15:22:47 EST


On Fri, Nov 06, 2026 at 08:42:52AM -0000, Wentao Liang wrote:
> hidma_issue_task() bumps the device usage counter with
> pm_runtime_get_sync() without checking the return value. The counter is
> incremented even when the resume fails, e.g. when runtime PM has been
> disabled or the device is suspending, and nothing drops it in that case,
> so each failure leaves the device with an elevated usage count and it can
> no longer runtime suspend.
>
> Use pm_runtime_resume_and_get(), which drops the reference it took when
> the resume fails, and do not start the transfer in that case. The counter
> taken by a successful resume is still dropped by hidma_callback() as
> before.
>
> Fixes: 67a2003e0607 ("dmaengine: add Qualcomm Technologies HIDMA channel driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> Changes in v2:
> - Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync()
> followed by pm_runtime_put_noidle(), as Frank Li suggested.
> - Link to v1: https://lore.kernel.org/all/20260916093032.2003397-1-vulab@xxxxxxxxxxx/
> - Sorry for the very late reply to this review.
>
> drivers/dma/qcom/hidma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
> index 1349066b1544..c49cf622e5fb 100644
> --- a/drivers/dma/qcom/hidma.c
> +++ b/drivers/dma/qcom/hidma.c
> @@ -219,7 +219,8 @@ static void hidma_issue_task(struct tasklet_struct *t)
> {
> struct hidma_dev *dmadev = from_tasklet(dmadev, t, task);
>
> - pm_runtime_get_sync(dmadev->ddev.dev);
> + if (pm_runtime_resume_and_get(dmadev->ddev.dev) < 0)
> + return;
> hidma_ll_start(dmadev->lldev);
> }
>
> --
> 2.34.1
>