Re: [PATCH 5.10 012/105] dmaengine: shdma: Fix runtime PM imbalance on error

From: Pavel Machek
Date: Wed Mar 09 2022 - 05:54:35 EST


Hi!

> From: Yongzhi Liu <lyz_cs@xxxxxxxxxx>
>
> [ 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.

This patch will break things.

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.

It was discussed during AUTOSEL review:

Date: Fri, 25 Feb 2022 14:25:10 +0800 (GMT+08:00)
From: 刘永志 <lyz_cs@xxxxxxxxxx>
To: pavel machek <pavel@xxxxxxx>
Cc: sasha levin <sashal@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
Subject: Re: [PATCH AUTOSEL 5.16 24/30] dmaengine: shdma: Fix runtime PM
imbalance on error

Best regards,
Pavel

> +++ 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
>
>

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature