All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan" <peng.fan@linux.dev>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 1/8] irqchip/imx-intmux: Don't create parent mappings while counting channels
Date: Thu, 03 Dec 2026 09:52:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-247506@kernel.org> (raw)
In-Reply-To: <20261203-imx-intmux-v2-1-a6db1eed3b5f@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] irqchip/imx-intmux: moving deferral to of_irq_get() leaks
  runtime PM state
--

commit 42b78989833d0bb58e9611bbf6a028b1d276be79
Author: Peng Fan <peng.fan@nxp.com>

irqchip/imx-intmux: Don't create parent mappings while counting channels

This commit replaces platform_irq_count() with of_irq_count() and uses
of_irq_get() inside the channel loop in imx_intmux_probe() so parent IRQ
mappings are not created while counting channels.

> diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
> index 73926dec52abf..7552a3d0c3695 100644
> --- a/drivers/irqchip/irq-imx-intmux.c
> +++ b/drivers/irqchip/irq-imx-intmux.c
> @@ -204,10 +204,8 @@ static int imx_intmux_probe(struct platform_device *pdev)
>  	int channum;
>  	int i, ret;
>  
> -	channum = platform_irq_count(pdev);
> -	if (channum == -EPROBE_DEFER) {
> -		return -EPROBE_DEFER;
> -	} else if (channum > CHAN_MAX_NUM) {
> +	channum = of_irq_count(np);
> +	if (channum > CHAN_MAX_NUM) {
>  		dev_err(&pdev->dev, "supports up to %d multiplex channels\n",
>  			CHAN_MAX_NUM);
>  		return -EINVAL;
> @@ -244,10 +242,12 @@ static int imx_intmux_probe(struct platform_device *pdev)
>  	for (i = 0; i < channum; i++) {
>  		data->irqchip_data[i].chanidx = i;
>  
> -		data->irqchip_data[i].irq = irq_of_parse_and_map(np, i);
> +		data->irqchip_data[i].irq = of_irq_get(np, i);
>  		if (data->irqchip_data[i].irq <= 0) {
> -			ret = -EINVAL;
> -			dev_err(&pdev->dev, "failed to get irq\n");
> +			ret = data->irqchip_data[i].irq;
> +			if (!ret)
> +				ret = -EINVAL;
> +			dev_err_probe(&pdev->dev, ret, "failed to get irq\n");
>  			goto out;
>  		}
>  

[Severity: Medium]
Does moving -EPROBE_DEFER from platform_irq_count() into of_irq_get() leak
runtime PM state when probe defers?

Previously, -EPROBE_DEFER returned before pm_runtime_get_noresume(),
pm_runtime_set_active(), and pm_runtime_enable() ran.  Now of_irq_get()
jumps to the out label, which only calls clk_disable_unprepare() and leaves
runtime PM enabled with usage_count set to 1.

Because runtime PM remains enabled, device_unbind_cleanup() ->
pm_runtime_reinit() returns early without resetting RPM_ACTIVE.  On the
retried probe, pm_runtime_enable() logs "Unbalanced pm_runtime_enable!" and
the extra usage_count permanently prevents runtime suspend.

If of_irq_get() defers on a channel after the first one, earlier channels
also stay registered with chained handlers pointing to devm-freed
intmux_data, causing a use-after-free.

This regression is fixed later in the series by commit "irqchip/imx-intmux:
Fix probe error path", so ordering that patch before this one would avoid
breaking bisection and standalone stable backports.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-imx-intmux-v2-0-a6db1eed3b5f@nxp.com?part=1

  reply	other threads:[~2026-12-03  9:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:29 [PATCH v2 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan
2026-12-03  9:29 ` [PATCH v2 1/8] irqchip/imx-intmux: Don't create parent mappings while counting channels Peng Fan
2026-12-03  9:52   ` sashiko-bot [this message]
2026-12-03  9:29 ` [PATCH v2 2/8] irqchip/imx-intmux: Dispose IRQ mappings on remove Peng Fan
2026-12-03  9:53   ` sashiko-bot
2026-12-03  9:29 ` [PATCH v2 3/8] irqchip/imx-intmux: Fix probe error path Peng Fan
2026-12-03  9:50   ` sashiko-bot
2026-12-03  9:29 ` [PATCH v2 4/8] irqchip/imx-intmux: Reject zero channel count Peng Fan
2026-12-03  9:29 ` [PATCH v2 5/8] irqchip/imx-intmux: Mark input interrupts as level-triggered Peng Fan
2026-12-03  9:40   ` sashiko-bot
2026-12-03  9:29 ` [PATCH v2 6/8] irqchip/imx-intmux: Don't WARN on malformed interrupt specifiers Peng Fan
2026-12-03  9:46   ` sashiko-bot
2026-12-03  9:29 ` [PATCH v2 7/8] irqchip/imx-intmux: Use devm_irq_domain_create_linear() Peng Fan
2026-12-03  9:55   ` sashiko-bot
2026-12-03  9:29 ` [PATCH v2 8/8] irqchip/imx-intmux: Factor out imx_intmux_teardown_channel() Peng Fan
2026-12-03 10:01   ` sashiko-bot
2026-12-03 14:14 ` [PATCH v2 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan

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=sashiko-outbox-247506@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=peng.fan@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.