[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McfBLaE=N12z29JjTDJ0ABzC8OW4rPWeeSU82kag+9pgQ@mail.gmail.com>
Date: Mon, 28 Sep 2020 10:44:38 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Bartosz Golaszewski <bgolaszewski@...libre.com>,
Linus Walleij <linus.walleij@...aro.org>,
Jonathan Corbet <corbet@....net>,
Kent Gibson <warthog618@...il.com>,
linux-gpio <linux-gpio@...r.kernel.org>,
linux-doc <linux-doc@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 8/9] gpio: mockup: use the generic 'gpio-line-names' property
On Fri, Sep 25, 2020 at 6:41 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> 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@...ux.intel.com> wrote:
> > > On Thu, Sep 24, 2020 at 01:38:41PM +0200, Bartosz Golaszewski wrote:
> > > > From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> > > >
> > > > GPIO line names are currently created by the driver from the chip label.
> > > > We'll want to support custom formats for line names (for instance: to
> > > > name all lines the same) for user-space tests so create them in the
> > > > module init function and pass them to the driver using the standard
> > > > 'gpio-line-names' property.
> > >
> > > ...
> > >
> > > > + if (gpio_mockup_named_lines) {
> > > > + line_names = gpio_mockup_make_line_names(chip_label,
> > > > + ngpio);
> > > > + if (!line_names) {
> > > > + platform_driver_unregister(&gpio_mockup_driver);
> > > > + gpio_mockup_unregister_pdevs();
> > > > + return -ENOMEM;
> > > > + }
> > >
> > > > + properties[prop++] = PROPERTY_ENTRY_STRING_ARRAY_LEN(
> > > > + "gpio-line-names",
> > > > + line_names, ngpio);
> > >
> > > Forgot to update GPIO_MOCKUP_MAX_PROP?
> > >
> >
> > No, there are still three properties: chip-label, nr-gpios and
> > gpio-line-names. Same answer to patch 8/9.
> >
> > > > + }
> > >
> > > ...
> > >
> > > > + 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. :)
I'll revert back to having the NULL check.
Bartosz
Powered by blists - more mailing lists