[PATCH 06/16] irqchip/loongson-liointc: unmap per-core iomaps on error
Haofeng Li <[email protected]> Tue, 14 Jul 2026 21:24:42 +0800
| Newsgroups | org.kernel.vger.linux-mips,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Haofeng Li <[email protected]> For revision > 1, liointc_init() maps per-core ISR regions with of_iomap(). out_iounmap only unmapped the main base, leaking successful per-core mappings on later failures. On the error path, iounmap any core_isr entry that is not an offset into the main base mapping. Fixes: 0858ed035a85 ("irqchip/loongson-liointc: Add ACPI init support") Signed-off-by: Haofeng Li <[email protected]> --- drivers/irqchip/irq-loongson-liointc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c index cf44a333b9c8..6451d8b466ce 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -312,6 +312,14 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, out_free_domain: irq_domain_remove(domain); out_iounmap: + if (revision > 1) { + for (i = 0; i < LIOINTC_NUM_CORES; i++) { + void __iomem *core_base = base + LIOINTC_REG_INTC_STATUS(i); + + if (priv->core_isr[i] && priv->core_isr[i] != core_base) + iounmap(priv->core_isr[i]); + } + } iounmap(base); out_free_priv: kfree(priv); -- 2.25.1