lkml.org 
[lkml]   [2020]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 01/14] irqchip/ath79-misc: Fix potential resource leaks
Date
In the function ath79_misc_intc_of_init(), system resources "irq" and
"base" were not released in a few error cases. Thus add jump targets
for the completion of the desired exception handling.

Fixes: 07ba4b061a79 ("irqchip/ath79-misc: Move the MISC driver from arch/mips/ath79/")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
drivers/irqchip/irq-ath79-misc.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c
index 3d641bb..53e0c50 100644
--- a/drivers/irqchip/irq-ath79-misc.c
+++ b/drivers/irqchip/irq-ath79-misc.c
@@ -133,7 +133,7 @@ static int __init ath79_misc_intc_of_init(
{
struct irq_domain *domain;
void __iomem *base;
- int irq;
+ int irq, ret;

irq = irq_of_parse_and_map(node, 0);
if (!irq) {
@@ -144,18 +144,26 @@ static int __init ath79_misc_intc_of_init(
base = of_iomap(node, 0);
if (!base) {
pr_err("Failed to get MISC IRQ registers\n");
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err_irq_dispose;
}

domain = irq_domain_add_linear(node, ATH79_MISC_IRQ_COUNT,
&misc_irq_domain_ops, base);
if (!domain) {
pr_err("Failed to add MISC irqdomain\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_iounmap;
}

ath79_misc_intc_domain_init(domain, irq);
return 0;
+
+err_iounmap:
+ iounmap(base);
+err_irq_dispose:
+ irq_dispose_mapping(irq);
+ return ret;
}

static int __init ar7100_misc_intc_of_init(
--
2.1.0
\
 
 \ /
  Last update: 2020-07-01 04:17    [W:0.201 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site