Re: [PATCH v3 09/10] gpiolib: use gpiochip_dup_line_label() in for_each helpers

From: Andy Shevchenko
Date: Mon Dec 04 2023 - 08:26:32 EST


On Mon, Dec 04, 2023 at 10:35:08AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Rework for_each_requested_gpio_in_range() to use the new helper to
> retrieve a dynamically allocated copy of the descriptor label and free
> it at the end of each iteration. We need to leverage the CLASS()'
> destructor to make sure that the label is freed even when breaking out
> of the loop.

...

> - if ((label = gpiochip_is_requested(chip, base + i)) == NULL) {} else

I see, but...

> + if ((*_data.label = \
> + gpiochip_dup_line_label(_chip, _base + *_data.i)) == NULL) {} \

...can we drop this NULL check by using !(...) notation?


--
With Best Regards,
Andy Shevchenko