Re: [PATCH v4 2/4] gpiolib: use kref in gpio_desc

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

 



czw., 20 lut 2020 o 13:05 Srinivas Kandagatla
<srinivas.kandagatla@xxxxxxxxxx> napisał(a):
>
>
>
> On 20/02/2020 10:01, Bartosz Golaszewski wrote:
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -2798,6 +2798,8 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label)
> >               goto done;
> >       }
> >
> > +     kref_init(&desc->ref);
> > +
>
> Should we not decrement refcount on the error path of this function?
>

On error the descriptor will still be unrequested so there's no point
in potentially calling gpiod_free(). Also: the next time someone
requests it and succeeds, we'll set it back to 1.

Bartosz




[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