Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: Frank.Li@kernel.org
Cc: andy.shevchenko@gmail.com, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	okaya@kernel.org, vkoul@kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] dmaengine: qcom_hidma: Fix runtime PM leak in hidma_issue_task()
Date: Wed, 16 Sep 2026 09:30:32 +0000	[thread overview]
Message-ID: <20260916093032.2003397-1-vulab@iscas.ac.cn> (raw)

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.

Bail out and drop the leaked increment with pm_runtime_put_noidle()
when the resume fails, and only start the transfer when the device is
actually resumed. The counter for a successful resume is still
dropped by hidma_callback() as before.

Fixes: 67a2003e0607 ("dmaengine: add Qualcomm Technologies HIDMA channel driver")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/dma/qcom/hidma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
index 5a8dca8db5ce..03a73dc9b066 100644
--- a/drivers/dma/qcom/hidma.c
+++ b/drivers/dma/qcom/hidma.c
@@ -220,7 +220,10 @@ 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_get_sync(dmadev->ddev.dev) < 0) {
+		pm_runtime_put_noidle(dmadev->ddev.dev);
+		return;
+	}
 	hidma_ll_start(dmadev->lldev);
 }
 
-- 
2.34.1



             reply	other threads:[~2026-09-16  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  9:30 Wentao Liang [this message]
2026-09-16 15:55 ` [PATCH] dmaengine: qcom_hidma: Fix runtime PM leak in hidma_issue_task() Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260916093032.2003397-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=Frank.Li@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okaya@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox