[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1592980367-1816-4-git-send-email-yangtiezhu@loongson.cn>
Date: Wed, 24 Jun 2020 14:32:36 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Thomas Gleixner <tglx@...utronix.de>,
Jason Cooper <jason@...edaemon.net>,
Marc Zyngier <maz@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
Xuefeng Li <lixuefeng@...ngson.cn>
Subject: [PATCH v2 03/14] irqchip/csky-mpintc: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them.
Fixes: d8a5f5f79122 ("irqchip: add C-SKY SMP interrupt controller")
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
drivers/irqchip/irq-csky-mpintc.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-csky-mpintc.c b/drivers/irqchip/irq-csky-mpintc.c
index a1534ed..c195e24 100644
--- a/drivers/irqchip/irq-csky-mpintc.c
+++ b/drivers/irqchip/irq-csky-mpintc.c
@@ -247,8 +247,10 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent)
if (INTCG_base == NULL) {
INTCG_base = ioremap(mfcr("cr<31, 14>"),
INTCL_SIZE*nr_cpu_ids + INTCG_SIZE);
- if (INTCG_base == NULL)
- return -EIO;
+ if (INTCG_base == NULL) {
+ ret = -EIO;
+ goto err_free;
+ }
INTCL_base = INTCG_base + INTCG_SIZE;
@@ -257,8 +259,10 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent)
root_domain = irq_domain_add_linear(node, nr_irq, &csky_irqdomain_ops,
NULL);
- if (!root_domain)
- return -ENXIO;
+ if (!root_domain) {
+ ret = -ENXIO;
+ goto err_iounmap;
+ }
/* for every cpu */
for_each_present_cpu(cpu) {
@@ -270,12 +274,22 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent)
#ifdef CONFIG_SMP
ipi_irq = irq_create_mapping(root_domain, IPI_IRQ);
- if (!ipi_irq)
- return -EIO;
+ if (!ipi_irq) {
+ ret = -EIO;
+ goto err_domain_remove;
+ }
set_send_ipi(&csky_mpintc_send_ipi, ipi_irq);
#endif
return 0;
+
+err_domain_remove:
+ irq_domain_remove(root_domain);
+err_iounmap:
+ iounmap(INTCG_base);
+err_free:
+ kfree(__trigger);
+ return ret;
}
IRQCHIP_DECLARE(csky_mpintc, "csky,mpintc", csky_mpintc_init);
--
2.1.0
Powered by blists - more mailing lists