Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1b7b1a5 authored by Alexander Popov's avatar Alexander Popov Committed by Thomas Gleixner
Browse files

irqdomain: Fix irq_domain_alloc_irqs_recursive() error handling



If an irq_domain is auto-recursive and irq_domain_alloc_irqs_recursive()
for its parent has returned an error, then do return and avoid calling
irq_domain_free_irqs_recursive() uselessly, because:
- if domain->ops->alloc() had failed for an auto-recursive irq_domain,
   then irq_domain_free_irqs_recursive() had already been called;
- if domain->ops->alloc() had failed for a not auto-recursive irq_domain,
   then there is nothing to free at all.

Signed-off-by: default avatarAlexander Popov <alex.popov@linux.com>
Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Link: http://lkml.kernel.org/r/1467505448-2850-1-git-send-email-alex.popov@linux.com


Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 99e9d958
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1192,7 +1192,9 @@ int irq_domain_alloc_irqs_recursive(struct irq_domain *domain,
	if (recursive)
		ret = irq_domain_alloc_irqs_recursive(parent, irq_base,
						      nr_irqs, arg);
	if (ret >= 0)
	if (ret < 0)
		return ret;

	ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
	if (ret < 0 && recursive)
		irq_domain_free_irqs_recursive(parent, irq_base, nr_irqs);