From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Marc Zyngier <maz@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: Huacai Chen <chenhc@lemote.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, Xuefeng Li <lixuefeng@loongson.cn>
Subject: [PATCH v3 06/14] irqchip/digicolor: Fix potential resource leaks
Date: Wed, 24 Jun 2020 15:29:34 +0800 [thread overview]
Message-ID: <1592983782-8842-7-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1592983782-8842-1-git-send-email-yangtiezhu@loongson.cn>
There exists potential resource leaks in the error path, fix them.
Fixes: 8041dfbd31cf ("irqchip: Conexant CX92755 interrupts controller driver")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
drivers/irqchip/irq-digicolor.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-digicolor.c b/drivers/irqchip/irq-digicolor.c
index fc38d2d..18c6e77 100644
--- a/drivers/irqchip/irq-digicolor.c
+++ b/drivers/irqchip/irq-digicolor.c
@@ -89,7 +89,8 @@ static int __init digicolor_of_init(struct device_node *node,
ucregs = syscon_regmap_lookup_by_phandle(node, "syscon");
if (IS_ERR(ucregs)) {
pr_err("%pOF: unable to map UC registers\n", node);
- return PTR_ERR(ucregs);
+ ret = PTR_ERR(ucregs);
+ goto err_iounmap;
}
/* channel 1, regular IRQs */
regmap_write(ucregs, UC_IRQ_CONTROL, 1);
@@ -98,7 +99,8 @@ static int __init digicolor_of_init(struct device_node *node,
irq_domain_add_linear(node, 64, &irq_generic_chip_ops, NULL);
if (!digicolor_irq_domain) {
pr_err("%pOF: unable to create IRQ domain\n", node);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err_iounmap;
}
ret = irq_alloc_domain_generic_chips(digicolor_irq_domain, 32, 1,
@@ -106,7 +108,7 @@ static int __init digicolor_of_init(struct device_node *node,
clr, 0, 0);
if (ret) {
pr_err("%pOF: unable to allocate IRQ gc\n", node);
- return ret;
+ goto err_domain_remove;
}
digicolor_set_gc(reg_base, 0, IC_INT0ENABLE_LO, IC_FLAG_CLEAR_LO);
@@ -115,5 +117,11 @@ static int __init digicolor_of_init(struct device_node *node,
set_handle_irq(digicolor_handle_irq);
return 0;
+
+err_domain_remove:
+ irq_domain_remove(digicolor_irq_domain);
+err_iounmap:
+ iounmap(reg_base);
+ return ret;
}
IRQCHIP_DECLARE(conexant_digicolor_ic, "cnxt,cx92755-ic", digicolor_of_init);
--
2.1.0
next prev parent reply other threads:[~2020-06-24 7:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 7:29 [PATCH v3 00/14] irqchip: Fix potential resource leaks Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 01/14] irqchip/ath79-misc: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 02/14] irqchip/csky-apb-intc: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 03/14] irqchip/csky-mpintc: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 04/14] irqchip/davinci-aintc: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 05/14] irqchip/davinci-cp-intc: " Tiezhu Yang
2020-06-24 7:29 ` Tiezhu Yang [this message]
2020-06-24 7:29 ` [PATCH v3 07/14] irqchip/dw-apb-ictl: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 08/14] irqchip/ls1x: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 09/14] irqchip/mscc-ocelot: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 10/14] irqchip/nvic: " Tiezhu Yang
2020-06-24 7:29 ` [PATCH v3 11/14] irqchip/omap-intc: Fix potential resource leak Tiezhu Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1592983782-8842-7-git-send-email-yangtiezhu@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=chenhc@lemote.com \
--cc=devicetree@vger.kernel.org \
--cc=jason@lakedaemon.net \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=maz@kernel.org \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).