The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Myeonghun Pak <mhun512@gmail.com>
To: Daniel Scally <dan.scally@ideasonboard.com>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: renesas: rzv2h-ivc: manage runtime PM with devres
Date: Tue,  4 Aug 2026 23:11:04 +0900	[thread overview]
Message-ID: <20260804141104.38891-1-mhun512@gmail.com> (raw)

Runtime PM is enabled before the IRQ is looked up.  If that lookup
fails, probe returns without disabling runtime PM.  The subdevice
initialization error path disables runtime PM but leaves autosuspend
enabled, while the remove path does neither.

Use devm_pm_runtime_enable() so the driver core disables autosuspend and
runtime PM on every failed probe and after remove.  This also makes the
manual subdevice error unwind unnecessary.

This issue was identified during our ongoing static-analysis research while
reviewing kernel code.

Fixes: f0b3984d821b ("media: platform: Add Renesas Input Video Control block driver")
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 .../media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c  | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c b/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c
index 355842abb24b..48f9fd818bff 100644
--- a/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c
+++ b/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c
@@ -202,7 +202,9 @@ static int rzv2h_ivc_probe(struct platform_device *pdev)
 
 	pm_runtime_set_autosuspend_delay(dev, 2000);
 	pm_runtime_use_autosuspend(dev);
-	pm_runtime_enable(dev);
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return ret;
 
 	ivc->irqnum = platform_get_irq(pdev, 0);
 	if (ivc->irqnum < 0)
@@ -210,14 +212,9 @@ static int rzv2h_ivc_probe(struct platform_device *pdev)
 
 	ret = rzv2h_ivc_initialise_subdevice(ivc);
 	if (ret)
-		goto err_disable_pm_runtime;
+		return ret;
 
 	return 0;
-
-err_disable_pm_runtime:
-	pm_runtime_disable(dev);
-
-	return ret;
 }
 
 static void rzv2h_ivc_remove(struct platform_device *pdev)
-- 
2.47.1

             reply	other threads:[~2026-08-04 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 14:11 Myeonghun Pak [this message]
2026-08-06  9:52 ` [PATCH] media: renesas: rzv2h-ivc: manage runtime PM with devres Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260804141104.38891-1-mhun512@gmail.com \
    --to=mhun512@gmail.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox