2022-01-17 05:13:02

by Yongzhi Liu

[permalink] [raw]
Subject: [PATCH] dmaengine: shdma: Fix runtime PM imbalance on error

pm_runtime_get_() increments the runtime PM usage counter even
when it returns an error code, thus a matching decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Yongzhi Liu <[email protected]>
---
drivers/dma/sh/shdma-base.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 158e5e7..b26ed69 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -115,8 +115,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
ret = pm_runtime_get(schan->dev);

spin_unlock_irq(&schan->chan_lock);
- if (ret < 0)
+ if (ret < 0) {
dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret);
+ pm_runtime_put(schan->dev);
+ }

pm_runtime_barrier(schan->dev);

--
2.7.4


2022-02-15 06:33:07

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: shdma: Fix runtime PM imbalance on error

On 15-01-22, 21:34, Yongzhi Liu wrote:
> pm_runtime_get_() increments the runtime PM usage counter even
> when it returns an error code, thus a matching decrement is needed on
> the error handling path to keep the counter balanced.

Applied, thanks

--
~Vinod