[PATCH v2 08/14] irqchip/ls1x: Fix potential resource leaks

From: Tiezhu Yang
Date: Wed Jun 24 2020 - 02:33:41 EST


There exists potential resource leaks in the error path, fix them.

Fixes: 9e543e22e204 ("irqchip: Add driver for Loongson-1 interrupt controller")
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
drivers/irqchip/irq-ls1x.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-ls1x.c b/drivers/irqchip/irq-ls1x.c
index 353111a..409001b 100644
--- a/drivers/irqchip/irq-ls1x.c
+++ b/drivers/irqchip/irq-ls1x.c
@@ -131,7 +131,7 @@ static int __init ls1x_intc_of_init(struct device_node *node,
if (!priv->domain) {
pr_err("ls1x-irq: cannot add IRQ domain\n");
err = -ENOMEM;
- goto out_iounmap;
+ goto out_dispose_irq;
}

err = irq_alloc_domain_generic_chips(priv->domain, 32, 2,
@@ -182,6 +182,8 @@ static int __init ls1x_intc_of_init(struct device_node *node,

out_free_domain:
irq_domain_remove(priv->domain);
+out_dispose_irq:
+ irq_dispose_mapping(parent_irq);
out_iounmap:
iounmap(priv->intc_base);
out_free_priv:
--
2.1.0