* [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM imbalance on error
[not found] <20220223022820.240649-1-sashal@kernel.org>
@ 2022-02-23 2:28 ` Sasha Levin
2022-02-24 22:39 ` Pavel Machek
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2022-02-23 2:28 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Yongzhi Liu, Vinod Koul, Sasha Levin, christophe.jaillet, arnd,
laurent.pinchart, dmaengine
From: Yongzhi Liu <lyz_cs@pku.edu.cn>
[ Upstream commit 455896c53d5b803733ddd84e1bf8a430644439b6 ]
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 <lyz_cs@pku.edu.cn>
Link: https://lore.kernel.org/r/1642311296-87020-1-git-send-email-lyz_cs@pku.edu.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 7f72b3f4cd1ae..19ac95c0098f0 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.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM imbalance on error
2022-02-23 2:28 ` [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM imbalance on error Sasha Levin
@ 2022-02-24 22:39 ` Pavel Machek
2022-02-25 6:25 ` 刘永志
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2022-02-24 22:39 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Yongzhi Liu, Vinod Koul, christophe.jaillet,
arnd, laurent.pinchart, dmaengine
[-- Attachment #1: Type: text/plain, Size: 716 bytes --]
Hi!
> From: Yongzhi Liu <lyz_cs@pku.edu.cn>
>
> [ Upstream commit 455896c53d5b803733ddd84e1bf8a430644439b6 ]
>
> 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.
I don't think that's right.
Notice that -ret is ignored (checked 4.4 and 5.10), so we don't
actually abort/return error; we just printk. We'll do two
pm_runtime_put's after the "fix".
Please drop from -stable.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM imbalance on error
2022-02-24 22:39 ` Pavel Machek
@ 2022-02-25 6:25 ` 刘永志
0 siblings, 0 replies; 3+ messages in thread
From: 刘永志 @ 2022-02-25 6:25 UTC (permalink / raw)
To: pavel machek
Cc: sasha levin, linux-kernel, stable, vinod koul, christophe.jaillet,
arnd, laurent.pinchart, dmaengine
> -----原始邮件-----
> 发件人: "Pavel Machek" <pavel@denx.de>
> 发送时间: 2022-02-25 06:39:08 (星期五)
> 收件人: "Sasha Levin" <sashal@kernel.org>
> 抄送: linux-kernel@vger.kernel.org, stable@vger.kernel.org, "Yongzhi Liu" <lyz_cs@pku.edu.cn>, "Vinod Koul" <vkoul@kernel.org>, christophe.jaillet@wanadoo.fr, arnd@arndb.de, laurent.pinchart@ideasonboard.com, dmaengine@vger.kernel.org
> 主题: Re: [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM imbalance on error
>
> Hi!
>
> > From: Yongzhi Liu <lyz_cs@pku.edu.cn>
> >
> > [ Upstream commit 455896c53d5b803733ddd84e1bf8a430644439b6 ]
> >
> > 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.
>
> I don't think that's right.
>
> Notice that -ret is ignored (checked 4.4 and 5.10), so we don't
> actually abort/return error; we just printk. We'll do two
> pm_runtime_put's after the "fix".
Thank you very much for the correction. I am very sorry that I caused you unnecessary trouble because of my carelessness.
The pm_runtime_put is indeed called later in __ld_cleanup, so only printk is needed at -ret and the patch is not right.
>
> Please drop from -stable.
>
> Best regards,
> Pavel
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-25 6:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220223022820.240649-1-sashal@kernel.org>
2022-02-23 2:28 ` [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM imbalance on error Sasha Levin
2022-02-24 22:39 ` Pavel Machek
2022-02-25 6:25 ` 刘永志
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).