Re: [PATCH 8/9] gpio: mockup: use the generic 'gpio-line-names' property

From: Andy Shevchenko
Date: Mon Sep 28 2020 - 05:11:24 EST


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.

--
With Best Regards,
Andy Shevchenko