diff mbox series

remoteproc: rcar: Fix PM imbalance if RPM_ACTIVE

Message ID 20240708083553.30799-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Rejected
Delegated to: Geert Uytterhoeven
Headers show
Series remoteproc: rcar: Fix PM imbalance if RPM_ACTIVE | expand

Commit Message

Biju Das July 8, 2024, 8:35 a.m. UTC
The pm_runtime_resume_and_get() returns 1 if RPM is active, in this
case it won't call a put. This will result in PM imbalance as it
treat this as an error and propagate this to caller and the caller
never calls corresponding put(). Fix this issue by checking error
condition only.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/remoteproc/rcar_rproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven July 8, 2024, 9:12 a.m. UTC | #1
Hi Biju,

On Mon, Jul 8, 2024 at 10:36 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> The pm_runtime_resume_and_get() returns 1 if RPM is active, in this
> case it won't call a put. This will result in PM imbalance as it
> treat this as an error and propagate this to caller and the caller
> never calls corresponding put(). Fix this issue by checking error
> condition only.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Thanks for your patch, but the code for pm_runtime_resume_and_get()
seems to disagree?
https://elixir.bootlin.com/linux/latest/source/include/linux/pm_runtime.h#L436

Gr{oetje,eeting}s,

                        Geert
Biju Das July 8, 2024, 9:17 a.m. UTC | #2
Hi Geert,

> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: Monday, July 8, 2024 10:12 AM
> Subject: Re: [PATCH] remoteproc: rcar: Fix PM imbalance if RPM_ACTIVE
> 
> Hi Biju,
> 
> On Mon, Jul 8, 2024 at 10:36 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > The pm_runtime_resume_and_get() returns 1 if RPM is active, in this
> > case it won't call a put. This will result in PM imbalance as it treat
> > this as an error and propagate this to caller and the caller never
> > calls corresponding put(). Fix this issue by checking error condition
> > only.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Thanks for your patch, but the code for pm_runtime_resume_and_get() seems to disagree?
> https://elixir.bootlin.com/linux/latest/source/include/linux/pm_runtime.h#L436

Oops. Missed that. Sorry for the noisy patch.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/remoteproc/rcar_rproc.c b/drivers/remoteproc/rcar_rproc.c
index cc17e8421f65..3373a74d8b3a 100644
--- a/drivers/remoteproc/rcar_rproc.c
+++ b/drivers/remoteproc/rcar_rproc.c
@@ -174,7 +174,7 @@  static int rcar_rproc_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 	ret = pm_runtime_resume_and_get(dev);
-	if (ret) {
+	if (ret < 0) {
 		dev_err(dev, "failed to power up\n");
 		return ret;
 	}