From: Frank Li <Frank.li@oss.nxp.com>
To: Zhipeng.wang_1@oss.nxp.com
Cc: Thomas Gleixner <tglx@kernel.org>, Marc Zyngier <maz@kernel.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Jindong Yue <jindong.yue@nxp.com>,
xuegang.liu@nxp.com, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 1/4] irqchip/imx-irqsteer: Fix error handling path in probe()
Date: Fri, 7 Aug 2026 14:01:53 -0500 [thread overview]
Message-ID: <anYroThNbI9hcU6z@SMW015318> (raw)
In-Reply-To: <20260807072346.1222389-2-Zhipeng.wang_1@oss.nxp.com>
On Fri, Aug 07, 2026 at 04:23:43PM +0900, Zhipeng.wang_1@oss.nxp.com wrote:
> From: Zhipeng Wang <zhipeng.wang_1@nxp.com>
>
> If the fsl,num-irqs sanity check rejects the value after the IRQ domain
> has already been created, probe() jumps to a single label that only calls
> clk_disable_unprepare(), leaving the freshly created IRQ domain leaked.
> The domain-creation failure path shares the same label, which is correct
> only because the domain is NULL there.
>
> Split the error path so that a failure after the domain has been created
> removes it before disabling the clock, and a failure before that goes
> straight to the clock cleanup.
>
> Fixes: 28528fca4908 ("irqchip/imx-irqsteer: Add multi output interrupts support")
> Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> ---
> Changes in v3:
> - New patch, split out of the single v2 patch. Fixes the irq_domain
> leak on the probe() error path reported by Sashiko AI on v2.
>
> drivers/irqchip/irq-imx-irqsteer.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
I suggest create helper devm_irq_domain_create_leaner()
static inline struct irq_domain *
devm_irq_domain_create_linear(struct fwnode_handle *fwnode,
unsigned int size,
const struct irq_domain_ops *ops,
void *host_data)
{
const struct irq_domain_info info = {
.fwnode = fwnode,
.size = size,
.hwirq_max = size,
.ops = ops,
.host_data = host_data,
};
struct irq_domain *d = devm_irq_domain_instantiate(&info);
return IS_ERR(d) ? NULL : d;
}
Then imx-irqsteer this devm version. So other drivers can get beneafit also
Frank
>
> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index 87b07f517be3..a2f0629b22a3 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c
> @@ -241,13 +241,13 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
> if (!data->domain) {
> dev_err(&pdev->dev, "failed to create IRQ domain\n");
> ret = -ENOMEM;
> - goto out;
> + goto err_clk;
> }
> irq_domain_set_pm_device(data->domain, &pdev->dev);
>
> if (!data->irq_count || data->irq_count > CHAN_MAX_OUTPUT_INT) {
> ret = -EINVAL;
> - goto out;
> + goto err_domain;
> }
>
> for (i = 0; i < data->irq_count; i++) {
> @@ -266,7 +266,10 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
> pm_runtime_enable(&pdev->dev);
>
> return 0;
> -out:
> +
> +err_domain:
> + irq_domain_remove(data->domain);
> +err_clk:
> clk_disable_unprepare(data->ipg_clk);
> return ret;
> }
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2026-08-07 19:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 7:23 [PATCH v3 0/4] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-08-07 7:23 ` [PATCH v3 1/4] irqchip/imx-irqsteer: Fix error handling path in probe() Zhipeng.wang_1
2026-08-07 19:01 ` Frank Li [this message]
2026-08-07 7:23 ` [PATCH v3 2/4] irqchip/imx-irqsteer: Dispose of IRQ mappings in remove() Zhipeng.wang_1
2026-08-07 19:11 ` Frank Li
2026-08-07 7:23 ` [PATCH v3 3/4] irqchip/imx-irqsteer: Mask all interrupts in probe() and remove() Zhipeng.wang_1
2026-08-07 19:14 ` Frank Li
2026-08-07 7:23 ` [PATCH v3 4/4] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
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=anYroThNbI9hcU6z@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=Zhipeng.wang_1@oss.nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jindong.yue@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=tglx@kernel.org \
--cc=xuegang.liu@nxp.com \
/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