linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <maz@kernel.org>
Cc: linux-kernel@vger.kernel.org, Markus Elfring <Markus.Elfring@web.de>
Subject: [PATCH v5 14/14] irqchip/xilinx-intc: Fix potential resource leak
Date: Mon,  6 Jul 2020 09:19:25 +0800	[thread overview]
Message-ID: <1593998365-25910-15-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1593998365-25910-1-git-send-email-yangtiezhu@loongson.cn>

In the function xilinx_intc_of_init(), system resource "irqc->root_domain"
was not released in an error case. Thus add a jump target to call the
function "irq_domain_remove" for the completion of the desired exception
handling.

Fixes: 9689c99e4950 ("irqchip/xilinx: Add support for parent intc")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 drivers/irqchip/irq-xilinx-intc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
index 1d3d273..41d9412 100644
--- a/drivers/irqchip/irq-xilinx-intc.c
+++ b/drivers/irqchip/irq-xilinx-intc.c
@@ -192,7 +192,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 	ret = of_property_read_u32(intc, "xlnx,num-intr-inputs", &irqc->nr_irq);
 	if (ret < 0) {
 		pr_err("irq-xilinx: unable to read xlnx,num-intr-inputs\n");
-		goto error;
+		goto err_iounmap;
 	}
 
 	ret = of_property_read_u32(intc, "xlnx,kind-of-intr", &irqc->intr_mask);
@@ -229,7 +229,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 	if (!irqc->root_domain) {
 		pr_err("irq-xilinx: Unable to create IRQ domain\n");
 		ret = -EINVAL;
-		goto error;
+		goto err_iounmap;
 	}
 
 	if (parent) {
@@ -241,7 +241,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 		} else {
 			pr_err("irq-xilinx: interrupts property not in DT\n");
 			ret = -EINVAL;
-			goto error;
+			goto err_domain_remove;
 		}
 	} else {
 		primary_intc = irqc;
@@ -250,11 +250,12 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 
 	return 0;
 
-error:
+err_domain_remove:
+	irq_domain_remove(irqc->root_domain);
+err_iounmap:
 	iounmap(irqc->base);
 	kfree(irqc);
 	return ret;
-
 }
 
 IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init);
-- 
2.1.0


  parent reply	other threads:[~2020-07-06  1:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  1:19 [PATCH v5 00/14] irqchip: Fix potential resource leaks Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 01/14] irqchip/ath79-misc: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 02/14] irqchip/csky-apb-intc: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 03/14] irqchip/csky-mpintc: " Tiezhu Yang
2020-07-06  6:14   ` Markus Elfring
2020-07-06  1:19 ` [PATCH v5 04/14] irqchip/davinci-aintc: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 05/14] irqchip/davinci-cp-intc: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 06/14] irqchip/digicolor: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 07/14] irqchip/dw-apb-ictl: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 08/14] irqchip/ls1x: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 09/14] irqchip/mscc-ocelot: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 10/14] irqchip/nvic: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 11/14] irqchip/omap-intc: Fix potential resource leak Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 12/14] irqchip/riscv-intc: " Tiezhu Yang
2020-07-06  1:19 ` [PATCH v5 13/14] irqchip/s3c24xx: Fix potential resource leaks Tiezhu Yang
2020-07-06  1:19 ` Tiezhu Yang [this message]
2020-07-06  7:30   ` [PATCH v5 14/14] irqchip/xilinx-intc: Fix potential resource leak Markus Elfring
2020-07-06  7:30 ` [PATCH v5 00/14] irqchip: Fix potential resource leaks Marc Zyngier
2020-07-06  7:43   ` Markus Elfring
2020-09-02  3:59   ` Tiezhu Yang
2020-10-12  2:31     ` 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=1593998365-25910-15-git-send-email-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=Markus.Elfring@web.de \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@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).