[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdKXJgn3ZNDit6Drz8xyTatLeg8M9+gkmtBFeaLFTn51w@mail.gmail.com>
Date: Tue, 27 Oct 2020 13:18:36 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Bartosz Golaszewski <bgolaszewski@...libre.com>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Michal Simek <michal.simek@...inx.com>,
linux-iio <linux-iio@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] iio: adc: xilinx: use devm_krealloc() instead of
kfree() + kcalloc()
On Tue, Oct 27, 2020 at 12:40 PM Bartosz Golaszewski
<bgolaszewski@...libre.com> wrote:
> On Tue, Oct 27, 2020 at 11:29 AM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
> > On Tue, Oct 27, 2020 at 12:04 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> > > On Tue, Oct 27, 2020 at 10:33 AM Andy Shevchenko
> > > <andy.shevchenko@...il.com> wrote:
...
> > I meant devm_krealloc(). It should work in this case without your
> > additional "fix" patch.
> I know, this is why I sent the fix separately. The fix is still
> correct on its own.
My point is it's not needed. At all.
It will actually make a regression. But this is for discussion in that thread.
...
> > > Or maybe add devm_krealloc_array() which would perform the checks
> > > behind the scenes?
> >
> > Maybe. But what to do in the cases when you have struct with flexible
> > arrays, like
> > struct foo {
> > ...
> > type bar[];
> > };
> >
> > ?
>
> Just use regular devm_krealloc() with struct_size()?
>
> >
> > And you do kzalloc(sizeof(foo)) followed by krealloc(). The above name
> > (krealloc_array) may be a bit ambiguous.
>
> But devm_krealloc_array() would only be useful for memory allocated by
> kmalloc_array() or kcalloc(). I don't see what's your point.
Naming ambiguity.
Here I'm not against it. If you think it's a good idea, go for it!
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists