Re: [PATCH v2 17/23] gpio: reduce the functionality of validate_desc()

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

 



On Mon, Feb 5, 2024 at 2:47 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Feb 05, 2024 at 10:34:12AM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> >
> > Checking desc->gdev->chip for NULL without holding it in place with some
> > serializing mechanism is pointless. Remove this check. Also don't check
> > desc->gdev for NULL as it can never happen. We'll be protecting
> > gdev->chip with SRCU soon but we will provide a dedicated, automatic
> > class for that.
>
> ...
>
> >  void gpiod_free(struct gpio_desc *desc)
> >  {
> > -     /*
> > -      * We must not use VALIDATE_DESC_VOID() as the underlying gdev->chip
> > -      * may already be NULL but we still want to put the references.
> > -      */
> > -     if (!desc)
> > -             return;
> > +     VALIDATE_DESC_VOID(desc);
>
> IIRC we (used to) have two cases like this (you added one in some code like
> last year).
>

None of the consumer-facing functions does it anymore. Not sure about
this, maybe it was removed earlier.

Bart





[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