Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 2/2] iio: viio_trigger_alloc(): Correctly free trigger on error
Date: Sun, 5 Dec 2021 19:10:59 +0000	[thread overview]
Message-ID: <20211205191059.42ec4691@jic23-huawei> (raw)
In-Reply-To: <CAHp75VdeNcNTedxeOBAt2aFz8yWTzv37YWD1km8bs5fuAg0QfA@mail.gmail.com>

On Sun, 31 Oct 2021 15:00:38 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Oct 31, 2021 at 11:15 AM Lars-Peter Clausen <lars@metafoo.de> wrote:
> > On 10/31/21 9:54 AM, Andy Shevchenko wrote:  
> > > On Sunday, October 31, 2021, Lars-Peter Clausen <lars@metafoo.de
> > > <mailto:lars@metafoo.de>> wrote:  
> 
> ...
> 
> > >     -       if (trig->subirq_base) {
> > >     +       if (trig->subirq_base > 0) {
> > >  
> > > >= ?  
> >
> > I don't know. 0 is not supposed to be a valid irq number. And we
> > kzalloc() the struct, so if it hasn't been explicitly initialized we'd
> > get 0.  
> 
> But it will change the behaviour of the code.
> >=0 is the opposite of replacing < 0.  
> 
> 
> > The way the code is at the moment we'd never end up here without calling
> > irq_alloc_descs(), so it is either a valid irq or a negative error code
> > and I can see why you might want to use >= for consistency and symmetry.  
> 
> Right!
> 
> (But on some architectures and cases 0 might be a valid vIRQ)
> 
Given I'm fairly sure this will be after any other irqs we should be fine
but I don't think it would be a problem to allow 0.

If that's fine with both of you I can just change it to >= 0 whilst
applying, or Lars can do a v2 when has time.

Thanks,

Jonathan


      reply	other threads:[~2021-12-05 19:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31  7:32 [PATCH 1/2] iio: iio_alloc_device(): Free device correctly on error Lars-Peter Clausen
2021-10-31  7:32 ` [PATCH 2/2] iio: viio_trigger_alloc(): Correctly free trigger " Lars-Peter Clausen
     [not found]   ` <CAHp75VfT-VgMODDdZCy8ERh1Uw8HVR6YuzmTukeP+nHbrx++sg@mail.gmail.com>
2021-10-31  9:15     ` Lars-Peter Clausen
2021-10-31 13:00       ` Andy Shevchenko
2021-12-05 19:10         ` Jonathan Cameron [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=20211205191059.42ec4691@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /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