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 <[email protected]>
---
drivers/gpio/gpio-rcar.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 7284473c9fe3..eac1582c70da 100644
--- 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);
return error;
+ }
error = pinctrl_gpio_request(chip->base + offset);
if (error)
--
2.17.1
On Fri, Jun 5, 2020 at 4:49 AM Navid Emamdoost
<[email protected]> 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 <[email protected]>
> ---
> drivers/gpio/gpio-rcar.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> index 7284473c9fe3..eac1582c70da 100644
> --- 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);
> return error;
> + }
I need Geert's review on this, he's usually on top of the Renesas stuff.
Yours,
Linus Walleij
Hi Linus,
On Wed, Jun 10, 2020 at 10:52 AM Linus Walleij <[email protected]> wrote:
> On Fri, Jun 5, 2020 at 4:49 AM Navid Emamdoost
> <[email protected]> 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 <[email protected]>
> > ---
> > drivers/gpio/gpio-rcar.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> > index 7284473c9fe3..eac1582c70da 100644
> > --- 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);
> > return error;
> > + }
>
> I need Geert's review on this, he's usually on top of the Renesas stuff.
TBH, I don't know anymore _which_ is the right call to make...
"Re: [PATCH] spi: spi-ti-qspi: call pm_runtime_put on pm_runtime_get failure"
https://lore.kernel.org/linux-spi/[email protected]/
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Hi Navid,
On Fri, Jun 5, 2020 at 4:50 AM Navid Emamdoost
<[email protected]> 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 <[email protected]>
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@mail.gmail.com
> 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 -- [email protected]
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
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 <[email protected]>
---
Changes in v2:
- use pm_runtime_put_noidle
---
drivers/gpio/gpio-rcar.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 7284473c9fe3..8fb9079a1d60 100644
--- 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_noidle(p->dev);
return error;
+ }
error = pinctrl_gpio_request(chip->base + offset);
if (error)
--
2.17.1
On Wed, Jun 17, 2020 at 9:40 AM Navid Emamdoost
<[email protected]> 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 <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Hi Geert,
On Wed, Jun 17, 2020 at 2:26 AM Geert Uytterhoeven <[email protected]> wrote:
>
> Hi Navid,
>
> On Fri, Jun 5, 2020 at 4:50 AM Navid Emamdoost
> <[email protected]> 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 <[email protected]>
>
> 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.
V2 was sent per your suggestion, thanks.
>
> [1] http://lore.kernel.org/r/CAJZ5v0i87NGcy9+kxubScdPDyByr8ypQWcGgBFn+V-wDd69BHQ@mail.gmail.com
>
> > 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 -- [email protected]
>
> 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
--
Navid.
śr., 17 cze 2020 o 09:43 Geert Uytterhoeven <[email protected]> napisał(a):
>
> On Wed, Jun 17, 2020 at 9:40 AM Navid Emamdoost
> <[email protected]> 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 <[email protected]>
>
> Reviewed-by: Geert Uytterhoeven <[email protected]>
>
Is this stable material?
Bart
Hi Bartosz,
On Mon, Jun 22, 2020 at 6:54 PM Bartosz Golaszewski
<[email protected]> wrote:
> śr., 17 cze 2020 o 09:43 Geert Uytterhoeven <[email protected]> napisał(a):
> > On Wed, Jun 17, 2020 at 9:40 AM Navid Emamdoost
> > <[email protected]> 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 <[email protected]>
> >
> > Reviewed-by: Geert Uytterhoeven <[email protected]>
>
> Is this stable material?
No, it cannot happen anyway.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
pt., 5 cze 2020 o 04:49 Navid Emamdoost <[email protected]> napisał(a):
>
> 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 <[email protected]>
> ---
> drivers/gpio/gpio-rcar.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> index 7284473c9fe3..eac1582c70da 100644
> --- 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);
> return error;
> + }
>
> error = pinctrl_gpio_request(chip->base + offset);
> if (error)
> --
> 2.17.1
>
Hi Navid!
This doesn't apply to current master. I think the previous version got
applied. Could you please rebase?
Bart