All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haotian Zhang <vulab@iscas.ac.cn>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, Haotian Zhang <vulab@iscas.ac.cn>
Subject: [PATCH] irqchip/ingenic-tcu: free generic chips on error path
Date: Tue, 18 Aug 2026 11:02:06 +0800	[thread overview]
Message-ID: <20260818030206.4420-1-vulab@iscas.ac.cn> (raw)

irq_alloc_domain_generic_chips() stores the allocated generic chip
data in domain->gc. On the error path taken when irq_of_parse_and_map()
fails, ingenic_tcu_irq_init() calls irq_domain_remove() without first
calling irq_domain_remove_generic_chips(). As the domain was created
with irq_domain_add_linear(), which does not set
IRQ_DOMAIN_FLAG_DESTROY_GC, irq_domain_remove() never frees the generic
chips and the allocation leaks.

Call irq_domain_remove_generic_chips() before irq_domain_remove() so
that the generic chip data is released on the error path.

Fixes: 9536eba03ec7 ("irqchip: Add irq-ingenic-tcu driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/irqchip/irq-ingenic-tcu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-ingenic-tcu.c b/drivers/irqchip/irq-ingenic-tcu.c
index 794ecba717c9..637fd90d97aa 100644
--- a/drivers/irqchip/irq-ingenic-tcu.c
+++ b/drivers/irqchip/irq-ingenic-tcu.c
@@ -171,6 +171,7 @@ static int __init ingenic_tcu_irq_init(struct device_node *np,
 	for (; i > 0; i--)
 		irq_dispose_mapping(tcu->parent_irqs[i - 1]);
 out_domain_remove:
+	irq_domain_remove_generic_chips(tcu->domain);
 	irq_domain_remove(tcu->domain);
 err_free_tcu:
 	kfree(tcu);
-- 
2.43.0


             reply	other threads:[~2026-08-18  3:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  3:02 Haotian Zhang [this message]
2026-08-19 19:34 ` [PATCH] irqchip/ingenic-tcu: free generic chips on error path Thomas Gleixner

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=20260818030206.4420-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.