mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Myeonghun Pak <mhun512@gmail.com>
To: Maxime Ripard <mripard@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Ijae Kim <ae878000@gmail.com>
Subject: [PATCH 2/2] media: cadence: csi2rx: disable error IRQ while runtime suspended
Date: Fri,  2 Oct 2026 20:24:51 -0400	[thread overview]
Message-ID: <6778a4ae61c46294f5014125fbe82618067e2c30.1790986123.git.mhun512@gmail.com> (raw)
In-Reply-To: <0d41c39bc84b97efdb8c06ef451fdaefcb331058.1790986123.git.mhun512@gmail.com>

The error IRQ handler accesses MMIO while runtime suspend can disable
its clocks without draining the handler.

Request the IRQ with IRQF_NO_AUTOEN, enable it after successful runtime
resume, and disable and drain it before runtime suspend gates clocks.

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

Fixes: c85d3d5362a8 ("media: cadence: csi2rx: Support runtime PM")
Assisted-by: LLM
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/media/platform/cadence/cdns-csi2rx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index f8c626e19aa84569737aa785a31a0f8c94087613..9bb776b5a4c8248a65df733e3a8963a6393f0996 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -982,7 +982,7 @@ static int csi2rx_probe(struct platform_device *pdev)
 		dev_dbg(csi2rx->dev, "Optional interrupt not defined, proceeding without it\n");
 	} else {
 		ret = devm_request_irq(csi2rx->dev, csi2rx->error_irq,
-				       csi2rx_irq_handler, 0,
+				       csi2rx_irq_handler, IRQF_NO_AUTOEN,
 				       dev_name(&pdev->dev), csi2rx);
 		if (ret) {
 			dev_err(csi2rx->dev,
@@ -1042,6 +1042,10 @@ static int csi2rx_runtime_suspend(struct device *dev)
 {
 	struct csi2rx_priv *csi2rx = dev_get_drvdata(dev);
 
+	/* Drain the handler before disabling the clocks it needs. */
+	if (csi2rx->error_irq >= 0)
+		disable_irq(csi2rx->error_irq);
+
 	reset_control_assert(csi2rx->sys_rst);
 	clk_disable_unprepare(csi2rx->sys_clk);
 
@@ -1082,6 +1086,9 @@ static int csi2rx_runtime_resume(struct device *dev)
 
 	reset_control_deassert(csi2rx->sys_rst);
 
+	if (csi2rx->error_irq >= 0)
+		enable_irq(csi2rx->error_irq);
+
 	return 0;
 
 err_disable_pixclk:

      reply	other threads:[~2026-10-03  0:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03  0:24 [PATCH 1/2] media: cadence: csi2rx: free error IRQ before private state Myeonghun Pak
2026-10-03  0:24 ` Myeonghun Pak [this message]

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=6778a4ae61c46294f5014125fbe82618067e2c30.1790986123.git.mhun512@gmail.com \
    --to=mhun512@gmail.com \
    --cc=ae878000@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=stable@vger.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

all inboxes | Powered by JetHome®