[PATCH] irqchip/irq-riscv-imsic-early: Fix fwnode leak on state setup failure

From: Haoxiang Li

Date: Tue Jun 23 2026 - 03:39:02 EST


imsic_early_acpi_init() allocates a firmware node with
irq_domain_alloc_named_fwnode() before setting up the
IMSIC state. If imsic_setup_state() fails, the function
returns without freeing the allocated fwnode.

Free the fwnode and clear the global pointer on this
error path, matching the cleanup already done when
imsic_early_probe() fails.

Fixes: fbe826b1c106 ("irqchip/riscv-imsic: Add ACPI support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Haoxiang Li <haoxiang_li2024@xxxxxxx>
---
drivers/irqchip/irq-riscv-imsic-early.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-riscv-imsic-early.c
index a7a1852b548c..b7cbfee3aeb2 100644
--- a/drivers/irqchip/irq-riscv-imsic-early.c
+++ b/drivers/irqchip/irq-riscv-imsic-early.c
@@ -272,6 +272,8 @@ static int __init imsic_early_acpi_init(union acpi_subtable_headers *header,
rc = imsic_setup_state(imsic_acpi_fwnode, imsic);
if (rc) {
pr_err("%pfwP: failed to setup state (error %d)\n", imsic_acpi_fwnode, rc);
+ irq_domain_free_fwnode(imsic_acpi_fwnode);
+ imsic_acpi_fwnode = NULL;
return rc;
}

--
2.25.1