Re: [libgpiod][PATCH] core: make the library NULL-aware

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

 



On Mon, Jan 9, 2023 at 12:30 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Jan 09, 2023 at 01:29:37PM +0200, Andy Shevchenko wrote:
> > On Fri, Jan 06, 2023 at 12:51:29PM +0100, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> ...
>
> > >  GPIOD_API void gpiod_line_config_free(struct gpiod_line_config *config)
> > >  {
> > > +   if (!config)
> > > +           return;
> > > +
> > >     free_refs(config);
> > >     free(config);
> > >  }
> >
> > At least this is redundant. free() is NULL-aware itself.
>
> And if free_refs() is not, it's better to make it explicit or fix that function
> if possible.

free_refs() is not public and it's used elsewhere too where the config
pointer is already checked. I prefer it this way.

Bartosz



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux