Re: [PATCH v4 4/8] iio: core: Calculate alloc_size only once in iio_device_alloc()

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

 



On Wed, Feb 28, 2024 at 02:57:36PM -0600, David Lechner wrote:
> On Wed, Feb 28, 2024 at 2:49 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

...

> > -       alloc_size = sizeof(struct iio_dev_opaque);
> > -       if (sizeof_priv) {
> > -               alloc_size = ALIGN(alloc_size, IIO_DMA_MINALIGN);
> > -               alloc_size += sizeof_priv;
> > -       }
> > +       if (sizeof_priv)
> > +               alloc_size = ALIGN(alloc_size, IIO_DMA_MINALIGN) + sizeof_priv;
> 
> Isn't this using alloc_size before it is assigned? Perhaps you meant this:
> 
>     alloc_size = ALIGN(sizeof(struct iio_dev_opaque),
> IIO_DMA_MINALIGN) + sizeof_priv;

However the end result of the series is correct, this is a good catch!
Thanks!

> > +       else
> > +               alloc_size = sizeof(struct iio_dev_opaque);

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux