dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 -next 1/3] dmaengine: qcom: bam_dma: fix PM usage counter unbalance in bam_dma
@ 2022-09-22 13:16 Zhang Qilong
  0 siblings, 0 replies; only message in thread
From: Zhang Qilong @ 2022-09-22 13:16 UTC (permalink / raw)
  To: agross, andersson, konrad.dybcio, vkoul; +Cc: linux-arm-msm, dmaengine

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 the newer pm_runtime_resume_and_get
to keep usage counter balanced.

Fixes:0ac9c3dd0d6fe ("dmaengine: qcom: bam_dma: fix runtime PM underflow")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 drivers/dma/qcom/bam_dma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 2ff787df513e..415ad0008f18 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -573,7 +573,7 @@ static void bam_free_chan(struct dma_chan *chan)
 	unsigned long flags;
 	int ret;
 
-	ret = pm_runtime_get_sync(bdev->dev);
+	ret = pm_runtime_resume_and_get(bdev->dev);
 	if (ret < 0)
 		return;
 
@@ -776,7 +776,7 @@ static int bam_pause(struct dma_chan *chan)
 	unsigned long flag;
 	int ret;
 
-	ret = pm_runtime_get_sync(bdev->dev);
+	ret = pm_runtime_resume_and_get(bdev->dev);
 	if (ret < 0)
 		return ret;
 
@@ -802,7 +802,7 @@ static int bam_resume(struct dma_chan *chan)
 	unsigned long flag;
 	int ret;
 
-	ret = pm_runtime_get_sync(bdev->dev);
+	ret = pm_runtime_resume_and_get(bdev->dev);
 	if (ret < 0)
 		return ret;
 
@@ -911,7 +911,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data)
 	if (srcs & P_IRQ)
 		tasklet_schedule(&bdev->task);
 
-	ret = pm_runtime_get_sync(bdev->dev);
+	ret = pm_runtime_resume_and_get(bdev->dev);
 	if (ret < 0)
 		return IRQ_NONE;
 
@@ -1029,7 +1029,7 @@ static void bam_start_dma(struct bam_chan *bchan)
 	if (!vd)
 		return;
 
-	ret = pm_runtime_get_sync(bdev->dev);
+	ret = pm_runtime_resume_and_get(bdev->dev);
 	if (ret < 0)
 		return;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-22 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 13:16 [PATCH v2 -next 1/3] dmaengine: qcom: bam_dma: fix PM usage counter unbalance in bam_dma Zhang Qilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).