Re: [PATCH 8/9] gpio: mockup: use the generic 'gpio-line-names' property
From: Bartosz Golaszewski
Date: Mon Sep 28 2020 - 05:58:30 EST
On Mon, Sep 28, 2020 at 11:11 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Mon, Sep 28, 2020 at 11:45 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
> > On Fri, Sep 25, 2020 at 6:41 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > On Fri, Sep 25, 2020 at 01:40:10PM +0200, Bartosz Golaszewski wrote:
> > > > On Fri, Sep 25, 2020 at 11:03 AM Andy Shevchenko
> > > > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > > > On Thu, Sep 24, 2020 at 01:38:41PM +0200, Bartosz Golaszewski wrote:
>
> ...
>
> > > > > > + kfree_strarray(line_names, line_names ? ngpio : 0);
> > > > >
> > > > > Perhaps you may check for NULL pointer in the kfree_strarray() and drop ternary
> > > > > here?
> > > > >
> > > >
> > > > I did in the previous series and you told me to not to. :)
> > >
> > > Hmm... What was my argument? What was wrong with me? free() should be NULL-aware.
> >
> > Well, it is - your just need to make sure ngpio is 0 too. :)
>
> Do you really need that? If you have NULL as a first parameter, the
> second one can be anything.
>
> > I'll revert back to having the NULL check.
>
Yes that's what I'm saying but under patch 1/9 you previously said:
--
Shouldn't we expect that caller will supply NULL, 0 and above check is not
needed?
--
this is why it works like this in v1.
Bartosz