All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fabio Estevam" <festevam@gmail.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH] irqchip: imx-irqsteer: Call pm_runtime_disable() on remove
Date: Wed, 29 Jul 2026 20:28:55 +0000	[thread overview]
Message-ID: <20260729202855.B7AC91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729201634.490317-1-festevam@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] `imx_irqsteer_remove()` unconditionally calls `clk_disable_unprepare()`, which causes a shared clock double-disable and underflow if the device is already runtime-suspended.
- [High] The chained interrupt handler `imx_irqsteer_irq_handler()` accesses memory-mapped registers without checking the runtime PM state, risking a system panic.
--

--- Patch [1]: [PATCH] irqchip: imx-irqsteer: Call pm_runtime_disable() on remove ---
commit 9f44afe2cbf39115bfc35bfc96ec7644902b8a9a
Author: Fabio Estevam <festevam@gmail.com>

irqchip: imx-irqsteer: Call pm_runtime_disable() on remove
    
imx_irqsteer_probe() enables runtime PM, but imx_irqsteer_remove()
does not disable it. This commit adds pm_runtime_disable() when
removing the device to prevent an unbalanced pm_runtime_enable.

Fixes: 4730d2233311 ("irqchip/imx-irqsteer: Add runtime PM support")
Signed-off-by: Fabio Estevam <festevam@gmail.com>

> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index 87b07f517be35..a695ba31db9a2 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c
> @@ -276,6 +276,8 @@ static void imx_irqsteer_remove(struct platform_device *pdev)
>  	struct irqsteer_data *irqsteer_data = platform_get_drvdata(pdev);
>  	int i;
>  
> +	pm_runtime_disable(&pdev->dev);
> +

[Severity: High]
This isn't a bug introduced by this patch, but this sequence appears to cause
a double-disable of the clock if the device is already runtime-suspended.

If the device is in RPM_SUSPENDED state when unbound via sysfs,
pm_runtime_disable() locks the PM state without resuming the device.

The clk_disable_unprepare() call at the end of imx_irqsteer_remove() is then
executed unconditionally:

drivers/irqchip/irq-imx-irqsteer.c:imx_irqsteer_remove() {
	...
	pm_runtime_disable(&pdev->dev);
	...
	clk_disable_unprepare(irqsteer_data->ipg_clk);
}

Could this decrease the clock enable count twice for a single prepare/enable
pair, stealing references from other active peripherals on the same bus?


[Severity: High]
This is a pre-existing issue, but the chained interrupt handler appears to
access memory-mapped registers without checking the runtime PM state.

If no child interrupts are requested, the device's PM usage count drops to 0,
disabling ipg_clk.

If a spurious interrupt arrives on the parent line,
imx_irqsteer_irq_handler() unconditionally accesses the registers:

drivers/irqchip/irq-imx-irqsteer.c:imx_irqsteer_irq_handler() {
	...
	irqmap = readl_relaxed(data->regs +
			       CHANSTATUS(idx, data->reg_num));
	...
}

Accessing these registers with ipg_clk disabled can cause a synchronous
external abort.

Should this handler check the PM state using pm_runtime_get_if_active()
before accessing the hardware?

>  	for (i = 0; i < irqsteer_data->irq_count; i++) {
>  		if (!irqsteer_data->irq[i])
>  			break;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729201634.490317-1-festevam@gmail.com?part=1

  reply	other threads:[~2026-07-29 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 20:16 [PATCH] irqchip: imx-irqsteer: Call pm_runtime_disable() on remove Fabio Estevam
2026-07-29 20:28 ` sashiko-bot [this message]
2026-07-29 20:37 ` Frank Li

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=20260729202855.B7AC91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.