gpio: rcar: handle pm_runtime_get_sync failure case
Subsystems (2)
PATCH 1/1 gpio: rcar: handle pm_runtime_get_sync failure case
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.
--- drivers/gpio/gpio-rcar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-rcar.c +3 -1
@@ -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)
Signature · 1 line
2.17.1
Quoted 14 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/gpio/gpio-rcar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpio/gpio-rcar.c +0
-0
drivers/gpio/gpio-rcar.c static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) · line 256
Quoted 8 lines
drivers/gpio/gpio-rcar.c +3
-1@@ -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,
Quoted 18 lines · Linus Walleij
Quoted 16 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/gpio/gpio-rcar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpio/gpio-rcar.c +0
-0@@ -250,8 +250,10 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)int error;
Quoted 8 lines
drivers/gpio/gpio-rcar.c static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) · line 256
Quoted 6 lines
drivers/gpio/gpio-rcar.c +3
-1error =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,
Quoted 5 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>
Thanks for your patch!
drivers/gpio/gpio-rcar.c static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) · line 254
Quoted 9 lines
drivers/gpio/gpio-rcar.c +2
-1@@ -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
drivers/gpio/gpio-rcar.c static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) · line 259
Quoted 5 lines
drivers/gpio/gpio-rcar.c +1
-0return error; + } error =pinctrl_gpio_request (chip->base + offset);if (error)
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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
PATCH v2 1/1 gpio: rcar: handle pm_runtime_get_sync failure case
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.
---
Changes in v2:
- use pm_runtime_put_noidle
--- drivers/gpio/gpio-rcar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-rcar.c +3 -1
@@ -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)
Signature · 1 line
2.17.1
Quoted 5 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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
śr., 17 cze 2020 o 09:43 Geert Uytterhoeven <[email protected]> napisał(a):
Quoted 11 lines
Quoted 5 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>
Is this stable material?
Bart
Hi Bartosz,
Quoted 7 lines · Bartosz Golaszewski
śr., 17 cze 2020 o 09:43 Geert Uytterhoeven <[email protected]> napisał(a):
Quoted 6 lines
Quoted 4 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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
Signature · 5 lines
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,
Quoted 18 lines · Geert Uytterhoeven
Hi Navid,
Quoted 5 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>Thanks for your patch!
Quoted 5 lines
drivers/gpio/gpio-rcar.c +0
-0@@ -250,8 +250,10 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)int error;
Quoted 6 lines
drivers/gpio/gpio-rcar.c static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) · line 254
Quoted 4 lines
drivers/gpio/gpio-rcar.c +2
-1error =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.
Quoted 19 lines
[1] http://lore.kernel.org/r/CAJZ5v0i87NGcy9+kxubScdPDyByr8ypQWcGgBFn+V-wDd69BHQ@mail.gmail.com
drivers/gpio/gpio-rcar.c static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) · line 259
Quoted 5 lines
drivers/gpio/gpio-rcar.c +1
-0return 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
Signature · 1 line
Navid.
pt., 5 cze 2020 o 04:49 Navid Emamdoost <[email protected]> napisał(a):
Quoted 27 lines
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/gpio/gpio-rcar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpio/gpio-rcar.c +3
-2@@ -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) --
Quoted 2 lines
2.17.1
Hi Navid!
This doesn't apply to current master. I think the previous version got applied. Could you please rebase?
Bart