[PATCH] dmaengine: usb-dmac: Fix PM usage counter imbalance

Zhang Shurong posted 1 patch 2 months, 3 weeks ago
drivers/dma/sh/usb-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] dmaengine: usb-dmac: Fix PM usage counter imbalance
Posted by Zhang Shurong 2 months, 3 weeks ago
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
Re: [PATCH] dmaengine: usb-dmac: Fix PM usage counter imbalance
Posted by Markus Elfring 2 months, 3 weeks ago
…
> result in reference leak here. We fix it by replacing
> it with pm_runtime_resume_and_get to keep usage counter
> balanced.

You may occasionally put more than 55 characters into text lines
of such a change description.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16-rc5#n94

Regards,
Markus