[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1592983782-8842-8-git-send-email-yangtiezhu@loongson.cn>
Date: Wed, 24 Jun 2020 15:29:35 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Thomas Gleixner <tglx@...utronix.de>,
Jason Cooper <jason@...edaemon.net>,
Marc Zyngier <maz@...nel.org>, Rob Herring <robh+dt@...nel.org>
Cc: Huacai Chen <chenhc@...ote.com>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-mips@...r.kernel.org, Xuefeng Li <lixuefeng@...ngson.cn>
Subject: [PATCH v3 07/14] irqchip/dw-apb-ictl: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them.
Fixes: 350d71b94fc9 ("irqchip: add DesignWare APB ICTL interrupt controller")
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
drivers/irqchip/irq-dw-apb-ictl.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
index e4550e9..bc9b750 100644
--- a/drivers/irqchip/irq-dw-apb-ictl.c
+++ b/drivers/irqchip/irq-dw-apb-ictl.c
@@ -86,12 +86,13 @@ static int __init dw_apb_ictl_init(struct device_node *np,
ret = of_address_to_resource(np, 0, &r);
if (ret) {
pr_err("%pOF: unable to get resource\n", np);
- return ret;
+ goto err_irq_dispose;
}
if (!request_mem_region(r.start, resource_size(&r), np->full_name)) {
pr_err("%pOF: unable to request mem region\n", np);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err_irq_dispose;
}
iobase = ioremap(r.start, resource_size(&r));
@@ -133,7 +134,7 @@ static int __init dw_apb_ictl_init(struct device_node *np,
IRQ_GC_INIT_MASK_CACHE);
if (ret) {
pr_err("%pOF: unable to alloc irq domain gc\n", np);
- goto err_unmap;
+ goto err_domain_remove;
}
for (i = 0; i < DIV_ROUND_UP(nrirqs, 32); i++) {
@@ -150,10 +151,14 @@ static int __init dw_apb_ictl_init(struct device_node *np,
return 0;
+err_domain_remove:
+ irq_domain_remove(domain);
err_unmap:
iounmap(iobase);
err_release:
release_mem_region(r.start, resource_size(&r));
+err_irq_dispose:
+ irq_dispose_mapping(irq);
return ret;
}
IRQCHIP_DECLARE(dw_apb_ictl,
--
2.1.0
Powered by blists - more mailing lists