From: Zhang Shurong <zhang_shurong@foxmail.com>
To: vkoul@kernel.org
Cc: yanzhen@vivo.com, u.kleine-koenig@baylibre.com,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
Zhang Shurong <zhang_shurong@foxmail.com>
Subject: [PATCH] dmaengine: usb-dmac: Fix PM usage counter imbalance
Date: Sun, 13 Jul 2025 00:51:52 +0800 [thread overview]
Message-ID: <tencent_891450514525826E2E6AD3B6ECC0B83C7209@qq.com> (raw)
pm_runtime_get_sync will increment pm usage counter
even it failed. Forgetting to putting operation will
result in reference leak here. We fix it by replacing
it with pm_runtime_resume_and_get to keep usage counter
balanced.
Fixes: 0c1c8ff32fa2 ("dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
drivers/dma/sh/usb-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index 7e2b6c97fa2f..6ced61c9feed 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -393,7 +393,7 @@ static int usb_dmac_alloc_chan_resources(struct dma_chan *chan)
uchan->descs_allocated++;
}
- return pm_runtime_get_sync(chan->device->dev);
+ return pm_runtime_resume_and_get(chan->device->dev);
}
static void usb_dmac_free_chan_resources(struct dma_chan *chan)
--
2.39.5
next reply other threads:[~2025-07-12 16:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-12 16:51 Zhang Shurong [this message]
2025-07-12 18:45 ` Markus Elfring
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=tencent_891450514525826E2E6AD3B6ECC0B83C7209@qq.com \
--to=zhang_shurong@foxmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=vkoul@kernel.org \
--cc=yanzhen@vivo.com \
/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
all inboxes | Powered by JetHome®