[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1592980367-1816-14-git-send-email-yangtiezhu@loongson.cn>
Date: Wed, 24 Jun 2020 14:32:46 +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 13/14] irqchip/s3c24xx: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them.
Fixes: f0774d41da0e ("irqchip: s3c24xx: add devicetree support")
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
drivers/irqchip/irq-s3c24xx.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index d2031fe..ef5d645 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -1239,7 +1239,8 @@ static int __init s3c_init_intc_of(struct device_node *np,
&s3c24xx_irq_ops_of, NULL);
if (!domain) {
pr_err("irq: could not create irq-domain\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_iounmap;
}
for (i = 0; i < num_ctrl; i++) {
@@ -1248,15 +1249,17 @@ static int __init s3c_init_intc_of(struct device_node *np,
pr_debug("irq: found controller %s\n", ctrl->name);
intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
- if (!intc)
- return -ENOMEM;
+ if (!intc) {
+ ret = -ENOMEM;
+ goto out_domain_remove;
+ }
intc->domain = domain;
intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data),
GFP_KERNEL);
if (!intc->irqs) {
- kfree(intc);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto out_free;
}
if (ctrl->parent) {
@@ -1285,6 +1288,13 @@ static int __init s3c_init_intc_of(struct device_node *np,
set_handle_irq(s3c24xx_handle_irq);
return 0;
+
+out_free:
+ kfree(intc);
+out_domain_remove:
+ irq_domain_remove(domain);
+out_iounmap:
+ iounmap(reg_base);
}
static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = {
--
2.1.0
Powered by blists - more mailing lists