From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759301AbcGKPTA (ORCPT ); Mon, 11 Jul 2016 11:19:00 -0400 Received: from foss.arm.com ([217.140.101.70]:53678 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759124AbcGKPS6 (ORCPT ); Mon, 11 Jul 2016 11:18:58 -0400 Subject: Re: [PATCH 1/1] irqdomain: Fix irq_domain_alloc_irqs_recursive() error handling To: Alexander Popov , Jiang Liu , Thomas Gleixner , linux-kernel@vger.kernel.org References: <1467505448-2850-1-git-send-email-alex.popov@linux.com> From: Marc Zyngier Organization: ARM Ltd Message-ID: <5783B8E0.3040103@arm.com> Date: Mon, 11 Jul 2016 16:18:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0 MIME-Version: 1.0 In-Reply-To: <1467505448-2850-1-git-send-email-alex.popov@linux.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/16 01:24, Alexander Popov wrote: > 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: Alexander Popov > --- > kernel/irq/irqdomain.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c > index 8798b6c..6458e34 100644 > --- a/kernel/irq/irqdomain.c > +++ b/kernel/irq/irqdomain.c > @@ -1144,8 +1144,10 @@ 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) > - ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg); > + 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); > > Acked-by: Marc Zyngier M. -- Jazz is not dead. It just smells funny...