Re: [PATCH] gpio: rcar: handle pm_runtime_get_sync failure case
From: Geert Uytterhoeven
Date: Wed Jun 17 2020 - 03:27:13 EST
Hi Navid,
On Fri, Jun 5, 2020 at 4:50 AM Navid Emamdoost
<navid.emamdoost@xxxxxxxxx> wrote:
> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put if
> pm_runtime_get_sync fails.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@xxxxxxxxx>
Thanks for your patch!
> --- a/drivers/gpio/gpio-rcar.c
> +++ b/drivers/gpio/gpio-rcar.c
> @@ -250,8 +250,10 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
> int error;
>
> error = pm_runtime_get_sync(p->dev);
> - if (error < 0)
> + if (error < 0) {
> + pm_runtime_put(p->dev);
As per [1], I would like to see a call to pm_runtime_put_noidle() instead.
[1] http://lore.kernel.org/r/CAJZ5v0i87NGcy9+kxubScdPDyByr8ypQWcGgBFn+V-wDd69BHQ@xxxxxxxxxxxxxx
> return error;
> + }
>
> error = pinctrl_gpio_request(chip->base + offset);
> if (error)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds