Re: [RFC PATCH 1/4] iio: core: Introduce iio_push_to_buffers_with_ts_na() for non aligned case.

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

 



On Mon, May 3, 2021 at 10:47 AM Sa, Nuno <Nuno.Sa@xxxxxxxxxx> wrote:
> > From: Sa, Nuno <Nuno.Sa@xxxxxxxxxx>
> > Sent: Monday, May 3, 2021 9:15 AM

...

> > Anyways, maybe sticking with realloc, we could just use a more normal
> > pattern like:
> >
> > tmp = devm_realloc(bounce_fuffer, ...);
> > if (!tmp)
> >     error;
> >
> > bounce_buffer = tmp;
> >
>
> I just read your reply to Andy about this and I think you are right... If the
> new allocation fails, the older pointer is still preserved. However, I find
> the above form a bit more readable and straight :)

You beat me up to it.

While devm_realloc() may actually be safer, the pattern is that: we
should not rely on specifics of the custom implementation, it will
really confuse new contributors  or people who may take this as a
"good' (which is not) pattern.



-- 
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