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 8/8] irqchip/imx-intmux: Use devm_pm_runtime_set_active_enabled()
Date: Tue, 17 Nov 2026 07:38:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-218364@kernel.org> (raw)
In-Reply-To: <20261117-imx-intmux-v1-8-189e7e0ad98d@nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] irqchip/imx-intmux: unexpected runtime_suspend() in devres
  teardown
- [High] irqchip/imx-intmux: unexpected runtime suspend in
  pm_runtime_disable_action()
--

commit 2bb337f25f51814af4aab296ab2a9e9b51b12962
Author: Peng Fan <peng.fan@nxp.com>

irqchip/imx-intmux: Use devm_pm_runtime_set_active_enabled()

This commit replaces manual pm_runtime_set_active(), pm_runtime_enable(),
pm_runtime_disable(), and pm_runtime_set_suspended() calls with
devm_pm_runtime_set_active_enabled().

> diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
> index 1f6e5d9c797aa..770656ef10ece 100644
> --- a/drivers/irqchip/irq-imx-intmux.c
> +++ b/drivers/irqchip/irq-imx-intmux.c
> @@ -234,9 +234,11 @@ static int imx_intmux_probe(struct platform_device *pdev)
>  	data->channum = channum;
>  	raw_spin_lock_init(&data->lock);
>  
> +	ret = devm_pm_runtime_set_active_enabled(&pdev->dev);
> +	if (ret)
> +		return ret;
> +
>  	pm_runtime_get_noresume(&pdev->dev);
> -	pm_runtime_set_active(&pdev->dev);
> -	pm_runtime_enable(&pdev->dev);
>  
>  	for (i = 0; i < channum; i++) {
>  		data->irqchip_data[i].chanidx = i;
> @@ -286,7 +288,6 @@ static int imx_intmux_probe(struct platform_device *pdev)
>  							     hwirq));
>  		irq_dispose_mapping(data->irqchip_data[i].irq);
>  	}
> -	pm_runtime_disable(&pdev->dev);
>  	pm_runtime_put_noidle(&pdev->dev);
>  	return ret;
>  }

[Severity: High]
Can removing pm_runtime_disable() from the probe error path cause a NULL
pointer dereference in imx_intmux_runtime_suspend() when channel setup
fails?

If irq_of_parse_and_map() or devm_irq_domain_create_linear() fails,
platform_set_drvdata() has not been called yet, and pm_runtime_put_noidle()
drops usage_count to 0 while runtime PM is still enabled and RPM_ACTIVE.
During devres teardown, pm_runtime_disable_action() calls
pm_runtime_dont_use_autosuspend() before pm_runtime_disable(), which runs
update_autosuspend() -> rpm_idle() -> rpm_suspend() synchronously.
imx_intmux_runtime_suspend() then reads a NULL dev_get_drvdata(dev) and
dereferences data->channum.

> @@ -312,11 +313,8 @@ static void imx_intmux_remove(struct platform_device *pdev)
>  		irq_dispose_mapping(data->irqchip_data[i].irq);
>  	}
>  
> -	pm_runtime_disable(&pdev->dev);
> -	if (ret >= 0) {
> +	if (ret >= 0)
>  		pm_runtime_put_noidle(&pdev->dev);
> -		pm_runtime_set_suspended(&pdev->dev);
> -	}
>  }

[Severity: High]
Does dropping pm_runtime_disable() in imx_intmux_remove() cause
data->ipg_clk to be disabled and unprepared twice on unbind?

imx_intmux_remove() resumes the device (enabling data->ipg_clk) and then
calls pm_runtime_put_noidle(), leaving usage_count at 0 while runtime PM is
enabled and RPM_ACTIVE.  When devres teardown runs
pm_runtime_disable_action(), pm_runtime_dont_use_autosuspend() synchronously
suspends the device via imx_intmux_runtime_suspend(), which calls
clk_disable_unprepare(data->ipg_clk) before the devm_clk_get_enabled()
release action disables and unprepares data->ipg_clk a second time.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-imx-intmux-v1-0-189e7e0ad98d@nxp.com?part=8

  reply	other threads:[~2026-11-17  7:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  7:14 [PATCH 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan
2026-11-17  7:14 ` [PATCH 1/8] irqchip/imx-intmux: Fix probe error path Peng Fan
2026-11-17  7:26   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 2/8] irqchip/imx-intmux: Dispose IRQ mappings on remove Peng Fan
2026-11-17  7:14 ` [PATCH 3/8] irqchip/imx-intmux: Handle platform_irq_count() errors Peng Fan
2026-11-17  7:26   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 4/8] irqchip/imx-intmux: Don't WARN on malformed interrupt specifiers Peng Fan
2026-11-17  7:14 ` [PATCH 5/8] irqchip/imx-intmux: Mark input interrupts as level-triggered Peng Fan
2026-11-17  7:22   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 6/8] irqchip/imx-intmux: Use devm_clk_get_enabled() Peng Fan
2026-11-17  7:28   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 7/8] irqchip/imx-intmux: Use devm_irq_domain_create_linear() Peng Fan
2026-11-17  7:14 ` [PATCH 8/8] irqchip/imx-intmux: Use devm_pm_runtime_set_active_enabled() Peng Fan
2026-11-17  7:38   ` sashiko-bot [this message]
2026-11-17 13:27 ` [PATCH 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-218364@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.