Re: [PATCH 08/16] irqchip/mips-gic: clean up if IPI domain registration fails

Radu Rendec <[email protected]> Sun, 02 Aug 2026 15:26:30 -0400
Newsgroups org.kernel.vger.linux-mips,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, 2026-07-14 at 21:24 +0800, Haofeng Li wrote:
> From: Haofeng Li <[email protected]>
>=20
> If gic_register_ipi_domain() fails, the primary IRQ domain and the
> mapped register base are left allocated.
>=20
> At this point the CPU interrupt handler has not yet been published.
> Remove the primary domain, unmap the register base, and clear both
> global pointers before returning the error.

IMO this patch should be squashed into the previous one in the series
because it fixes a similar problem in the same function of the same
driver, and the change is very much related.

But please see my comments to the previous patch. I think you are
trying to fix a problem that does not exist.

> Fixes: 8190cc572981 ("irqchip/mips-gic: Only register IPI domain when SMP=
 is enabled")
>=20
> Signed-off-by: Haofeng Li <[email protected]>
> ---
> =C2=A0drivers/irqchip/irq-mips-gic.c | 7 ++++++-
> =C2=A01 file changed, 6 insertions(+), 1 deletion(-)
>=20
> diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gi=
c.c
> index 85fe0d8a34c5..2f2ba54f227f 100644
> --- a/drivers/irqchip/irq-mips-gic.c
> +++ b/drivers/irqchip/irq-mips-gic.c
> @@ -968,8 +968,13 @@ static int __init gic_of_init(struct device_node *no=
de,
> =C2=A0	}
> =C2=A0
> =C2=A0	ret =3D gic_register_ipi_domain(node);
> -	if (ret)
> +	if (ret) {
> +		irq_domain_remove(gic_irq_domain);
> +		gic_irq_domain =3D NULL;
> +		iounmap(mips_gic_base);
> +		mips_gic_base =3D NULL;
> =C2=A0		return ret;
> +	}
> =C2=A0
> =C2=A0	if (cpu_has_veic) {
> =C2=A0		/* Always use vector 1 in EIC mode */