Skip to contentSkip to conversation

irqdomain: Preserve reused IRQ descriptors on allocation failure

PATCH New Avi Weiss 1 participant 1 message Oct 31

Subsystems (2)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 irqdomain: Preserve reused IRQ descriptors on allocation failure

When __irq_domain_alloc_irqs() reuses an existing IRQ descriptor, irq_domain_alloc_irqs_locked() frees that descriptor if IRQ data or hierarchy allocation fails. This removes an IRQ descriptor which was allocated before the call.

Only free descriptors allocated by irq_domain_alloc_irqs_locked(). Leave reused descriptors intact on failure.

Fixes f8264e34965a ("irqdomain: Introduce new interfaces to support hierarchy irqdomains")
---
 kernel/irq/irqdomain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/irq/irqdomain.c +2 -1
index 4fdcb6df5306..494a7982f1ab 100644
@@ -1672,7 +1672,8 @@ static int irq_domain_alloc_irqs_locked(struct irq_domain *domain, int irq_base,
 out_free_irq_data:
 	irq_domain_free_irq_data(virq, nr_irqs);
 out_free_desc:
-	irq_free_descs(virq, nr_irqs);
+	if (!realloc || irq_base < 0)
+		irq_free_descs(virq, nr_irqs);
 	return ret;
 }
 

base-commit: 36aad21d50d1af3f6954bb0c988257a908202477

Signature · 1 line
2.43.0