All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Popov <alex.popov@linux.com>
To: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org,
	Alexander Popov <alex.popov@linux.com>
Subject: Re: [PATCH 1/1] irqdomain: Fix irq_domain_alloc_irqs_recursive() error handling
Date: Mon, 11 Jul 2016 14:53:27 +0300	[thread overview]
Message-ID: <578388B7.7080203@linux.com> (raw)
In-Reply-To: <1467505448-2850-1-git-send-email-alex.popov@linux.com>

On 03.07.2016 03: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.

Hello.
Could I have a feedback, please?

Best regards,
Alexander

> Signed-off-by: Alexander Popov <alex.popov@linux.com>
> ---
>  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);
>  
> 

  reply	other threads:[~2016-07-11 11:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-03  0:24 [PATCH 1/1] irqdomain: Fix irq_domain_alloc_irqs_recursive() error handling Alexander Popov
2016-07-11 11:53 ` Alexander Popov [this message]
2016-07-11 15:18 ` Marc Zyngier
2016-07-11 15:27 ` [tip:irq/core] " tip-bot for Alexander Popov

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=578388B7.7080203@linux.com \
    --to=alex.popov@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --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.