On Mon, Jan 09, 2023 at 06:36:56PM +0100, Bartosz Golaszewski wrote: > 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. Then perhaps if (config) free_refs(config); free(config); ? P.S. Up to you since it's a minor stuff. -- With Best Regards, Andy Shevchenko