Re: [PATCH] irqchip/ingenic-tcu: free generic chips on error path

From: Thomas Gleixner

Date: Wed Aug 19 2026 - 15:34:20 EST


On Tue, Aug 18 2026 at 11:02, Haotian Zhang wrote:
> 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.

No. Set the stupid flag on the domain and let the core code do it.