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

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

 



On Mon, Dec 4, 2023 at 2:24 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> 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?
>

I'd rather not. this is already quite hard to understand and a single
`!` is less readable than `== NULL`.

Bart

>
> --
> With Best Regards,
> Andy Shevchenko
>
>





[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