[PATCH v5 12/14] irqchip/riscv-intc: Fix potential resource leak

From: Tiezhu Yang
Date: Sun Jul 05 2020 - 21:27:07 EST


In the function riscv_intc_init(), system resource "intc_domain"
was not released in an error case. Thus add a call of the function
"irq_domain_remove" in the if branch.

Fixes: 6b7ce8927b5a ("irqchip: RISC-V per-HART local interrupt controller driver")
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
Reviewed-by: Anup Patel <anup@xxxxxxxxxxxxxx>
---
drivers/irqchip/irq-riscv-intc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c
index a6f97fa..8d6286c 100644
--- a/drivers/irqchip/irq-riscv-intc.c
+++ b/drivers/irqchip/irq-riscv-intc.c
@@ -122,6 +122,7 @@ static int __init riscv_intc_init(struct device_node *node,
rc = set_handle_irq(&riscv_intc_irq);
if (rc) {
pr_err("failed to set irq handler\n");
+ irq_domain_remove(intc_domain);
return rc;
}

--
2.1.0