public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Marc Zyngier <maz@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Timothy Hayes <timothy.hayes@arm.com>,
	Sascha Bischoff <sascha.bischoff@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] irqchip/gic-v5: Fix error handling in gicv5_its_irq_domain_alloc()
Date: Thu, 17 Jul 2025 17:18:41 +0200	[thread overview]
Message-ID: <aHkUUWFk/AIxh1Nj@lpieralisi> (raw)
In-Reply-To: <5c22b679-853d-410c-973a-ba3c91a54b84@suswa.mountain>

On Thu, Jul 17, 2025 at 05:41:06PM +0300, Dan Carpenter wrote:
> On Thu, Jul 17, 2025 at 11:25:15AM +0200, Lorenzo Pieralisi wrote:
> > On Wed, Jul 16, 2025 at 02:38:22PM -0500, Dan Carpenter wrote:
> > > There are two issues to fix in this code:
> > > 1) If gicv5_alloc_lpi() fails the original code was checking the wrong
> > > variable.  Fix the mixup between "ret" and "lpi".
> > > 2) If irq_domain_alloc_irqs_parent() fails, then clean up all the loop
> > > iterations instead of just the current iteration.
> > > 
> > > Fixes: 57d72196dfc8 ("irqchip/gic-v5: Add GICv5 ITS support")
> > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > > ---
> > >  drivers/irqchip/irq-gic-v5-its.c | 14 +++++++++++---
> > >  1 file changed, 11 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
> > > index 55360ae9f1f6..8cc8563e27d5 100644
> > > --- a/drivers/irqchip/irq-gic-v5-its.c
> > > +++ b/drivers/irqchip/irq-gic-v5-its.c
> > > @@ -949,15 +949,18 @@ static int gicv5_its_irq_domain_alloc(struct irq_domain *domain, unsigned int vi
> > >  	device_id = its_dev->device_id;
> > >  
> > >  	for (i = 0; i < nr_irqs; i++) {
> > > -		lpi = gicv5_alloc_lpi();
> > > +		ret = gicv5_alloc_lpi();
> > >  		if (ret < 0) {
> > >  			pr_debug("Failed to find free LPI!\n");
> > >  			goto out_eventid;
> > 
> > This should be:
> > 
> > goto out_free_lpi;
> > 
> 
> Yes, you're right.

While at it I'd rename the label, out_free_irqs or something like
that, now we are doing more than freeing an LPI.

> > otherwise we miss cleaning up for [0, i - 1] on LPI alloc failure.
> > 
> > I can fix it up - not sure it is worth splitting it into two patches,
> > just let me know please how you want me to handle it.
> 
> I don't think it should be split up.  As a reviewer I would be annoyed
> by a split up version of this.
> 
> I'm a little bit surprised by the offer to fix it up for me...  Is this
> going through your tree?  It's probably easiest if I just send a v2...
> Let me do that.

I just wanted to help. FYI Marc has sent a PR today mentioning these patches:

https://lore.kernel.org/lkml/20250717122306.4043011-1-maz@kernel.org/

I think that keeping the CC list is good so that Thomas can pick them
up if he pulls the branch.

Thanks again for fixing these issues.

Lorenzo


      reply	other threads:[~2025-07-17 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1752693640.git.dan.carpenter@linaro.org>
2025-07-16 19:37 ` [PATCH 1/3] irqchip/gic-v5: Delete a stray tab Dan Carpenter
2025-07-16 19:37 ` [PATCH 2/3] irqchip/gic-v5: Fix forever loop in gicv5_its_create_itt_two_level() error handling Dan Carpenter
2025-07-16 19:38 ` [PATCH 3/3] irqchip/gic-v5: Fix error handling in gicv5_its_irq_domain_alloc() Dan Carpenter
2025-07-17  9:25   ` Lorenzo Pieralisi
2025-07-17 14:41     ` Dan Carpenter
2025-07-17 15:18       ` Lorenzo Pieralisi [this message]

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=aHkUUWFk/AIxh1Nj@lpieralisi \
    --to=lpieralisi@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=sascha.bischoff@arm.com \
    --cc=tglx@linutronix.de \
    --cc=timothy.hayes@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox