Re: [PATCH 2/2] iio: viio_trigger_alloc(): Correctly free trigger on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 31, 2021 at 11:15 AM Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:
> On 10/31/21 9:54 AM, Andy Shevchenko wrote:
> > On Sunday, October 31, 2021, Lars-Peter Clausen <lars@xxxxxxxxxx
> > <mailto:lars@xxxxxxxxxx>> 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)

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux