From: Frank Li <Frank.li@oss.nxp.com>
To: sashiko-reviews@lists.linux.dev
Cc: Zhipeng.wang_1@oss.nxp.com, imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v6 4/9] irqchip/imx-irqsteer: Convert to devm_pm_runtime_set_active_enabled()
Date: Thu, 8 Oct 2026 15:46:04 -0500 [thread overview]
Message-ID: <asgBDAfInvaIGbYL@SMW015318> (raw)
In-Reply-To: <sashiko-outbox-163926@kernel.org>
On Thu, Oct 08, 2026 at 09:21:24AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] irqchip/imx-irqsteer: NULL pointer dereference in suspend due to early PM enable
> --
>
> commit 5322ea0be538e254fa9c813752002c35702c23cf
> Author: Zhipeng Wang <zhipeng.wang_1@nxp.com>
>
> irqchip/imx-irqsteer: Convert to devm_pm_runtime_set_active_enabled()
>
> imx_irqsteer_probe() enables runtime PM with pm_runtime_enable(), but
> imx_irqsteer_remove() never disables it. Runtime PM therefore stays
> enabled after the device is unbound, and rebinding it triggers an
> unbalanced pm_runtime_enable warning. This commit uses
> devm_pm_runtime_set_active_enabled() to automatically disable runtime PM
> on unbind, fixing the imbalance.
>
> > diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> > index d05de3d26fb28..5acc04504e520 100644
> > --- a/drivers/irqchip/irq-imx-irqsteer.c
> > +++ b/drivers/irqchip/irq-imx-irqsteer.c
> > @@ -239,6 +239,10 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
> > if (irqsteer_has_chanctrl(data->devtype_data))
> > writel_relaxed(BIT(data->channel), data->regs + CHANCTRL);
> >
> > + ret = devm_pm_runtime_set_active_enabled(&pdev->dev);
> > + if (ret)
> > + goto out;
> > +
>
> [Severity: High]
> Does moving the PM runtime enablement before platform_set_drvdata() introduce
> a race condition?
>
> The PM runtime is now enabled early, and the IRQ domain is subsequently
> created and exposed globally.
>
> If a concurrent child device or userspace sysfs bind maps, requests, and
> releases an IRQ from this domain before platform_set_drvdata() is reached,
> releasing the IRQ invokes irq_bus_sync_unlock().
>
> This in turn calls pm_runtime_put_autosuspend(), dropping the usage count to
> zero and queuing a runtime suspend which invokes imx_irqsteer_suspend().
>
> Since platform_set_drvdata() has not been called yet, will dev_get_drvdata()
> return NULL in the suspend callback and cause a NULL pointer dereference when
> passed to imx_irqsteer_save_regs()?
Please fix this problem also
Frank
>
> > data->domain = irq_domain_create_linear(dev_fwnode(&pdev->dev), data->reg_num * 32,
> > &imx_irqsteer_domain_ops, data);
>
> [ ... ]
>
> > @@ -260,9 +264,6 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
> >
> > platform_set_drvdata(pdev, data);
> >
> > - pm_runtime_set_active(&pdev->dev);
> > - pm_runtime_enable(&pdev->dev);
> > -
> > return 0;
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261008090231.796511-1-Zhipeng.wang_1@oss.nxp.com?part=4
next prev parent reply other threads:[~2026-10-08 20:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 9:02 [PATCH v6 0/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 1/9] irqchip/imx-irqsteer: Call chained_irq_exit() on the handler error path Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 2/9] irqchip/imx-irqsteer: Validate IRQ count before creating domain Zhipeng.wang_1
2026-10-08 20:36 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 3/9] irqchip/imx-irqsteer: Dispose of parent IRQ mappings in remove() Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 4/9] irqchip/imx-irqsteer: Convert to devm_pm_runtime_set_active_enabled() Zhipeng.wang_1
2026-10-08 9:21 ` sashiko-bot
2026-10-08 20:46 ` Frank Li [this message]
2026-10-10 8:38 ` Zhipeng Wang (OSS)
2026-10-08 20:41 ` Frank Li
2026-10-10 8:26 ` Zhipeng Wang (OSS)
2026-10-08 9:02 ` [PATCH v6 5/9] irqchip/imx-irqsteer: Mask all interrupts in probe() Zhipeng.wang_1
2026-10-08 9:18 ` sashiko-bot
2026-10-08 20:59 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 6/9] irqchip/imx-irqsteer: Let devres own the clock Zhipeng.wang_1
2026-10-08 9:13 ` sashiko-bot
2026-10-08 20:54 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 7/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-10-08 9:19 ` sashiko-bot
2026-10-08 9:02 ` [PATCH v6 8/9] genirq/irqdomain: Add devm_irq_domain_create_linear() Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 9/9] irqchip/imx-irqsteer: Use devm_irq_domain_create_linear() Zhipeng.wang_1
2026-10-08 9:15 ` sashiko-bot
2026-10-08 21:01 ` Frank Li
2026-10-10 9:06 ` Zhipeng Wang (OSS)
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=asgBDAfInvaIGbYL@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=Zhipeng.wang_1@oss.nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox