Re: [PATCH v2] irqchip: imx-irqsteer: Convert to devm_pm_runtime_enable()

Radu Rendec <[email protected]> Sat, 01 Aug 2026 14:54:29 -0400
Newsgroups dev.linux.lists.imx,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, 2026-07-29 at 22:22 -0400, Radu Rendec wrote:
> On Wed, 2026-07-29 at 19:14 -0300, Fabio Estevam wrote:
> > imx_irqsteer_probe() enables runtime PM, but imx_irqsteer_remove()
> > does not disable it.
> >=20
> > Consequently, runtime PM remains enabled after unbinding the device,
> > and rebinding it triggers:
> >=20
> > Unbalanced pm_runtime_enable!
> >=20
> > Use devm_pm_runtime_enable() to automatically disable runtime PM when
> > the device is removed.
> >=20
> > Fixes: 4730d2233311 ("irqchip/imx-irqsteer: Add runtime PM support")
> > Signed-off-by: Fabio Estevam <[email protected]>
> > ---
> > Changes since v1:
> > - Use devm_pm_runtime_enable() (Frank)
> >=20
> > =C2=A0drivers/irqchip/irq-imx-irqsteer.c | 4 +++-
> > =C2=A01 file changed, 3 insertions(+), 1 deletion(-)
> >=20
> > diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-i=
mx-irqsteer.c
> > index 87b07f517be3..ba1203d3edd4 100644
> > --- a/drivers/irqchip/irq-imx-irqsteer.c
> > +++ b/drivers/irqchip/irq-imx-irqsteer.c
> > @@ -263,7 +263,9 @@ static int imx_irqsteer_probe(struct platform_devic=
e *pdev)
> > =C2=A0	platform_set_drvdata(pdev, data);
> > =C2=A0
> > =C2=A0	pm_runtime_set_active(&pdev->dev);
> > -	pm_runtime_enable(&pdev->dev);
> > +	ret =3D devm_pm_runtime_enable(&pdev->dev);
> > +	if (ret)
> > +		goto out;
> > =C2=A0
> > =C2=A0	return 0;
> > =C2=A0out:
>=20
> Reviewed-by: Radu Rendec <[email protected]>

I take that back. At a closer look, I think both issues identified by
Sashiko are valid. While the second issue is marked as "pre-existing",
the proposed patch introduces a new path where the issue can occur
(leaking the irq domain).

While at it, I would also fix the existing issue that the bot
identified, where the domain is leaked on this path:

        if (!data->irq_count || data->irq_count > CHAN_MAX_OUTPUT_INT) {
                ret =3D -EINVAL;
                goto out;
        }