[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MdaWEv+aj-W8TTJVDgKBOTrMt48ox48e37UAaY8FhorOw@mail.gmail.com>
Date: Mon, 4 Dec 2023 14:39:34 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v3 09/10] gpiolib: use gpiochip_dup_line_label() in
for_each helpers
On Mon, Dec 4, 2023 at 2:24 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Mon, Dec 04, 2023 at 10:35:08AM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> >
> > 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
>
>
Powered by blists - more mailing lists