2020-06-05 02:56:23

by Navid Emamdoost

[permalink] [raw]
Subject: [PATCH] gpio: arizona: 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.

Signed-off-by: Navid Emamdoost <[email protected]>
---
drivers/gpio/gpio-arizona.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c
index 5640efe5e750..7520a13b4c7c 100644
--- a/drivers/gpio/gpio-arizona.c
+++ b/drivers/gpio/gpio-arizona.c
@@ -106,6 +106,7 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip,
ret = pm_runtime_get_sync(chip->parent);
if (ret < 0) {
dev_err(chip->parent, "Failed to resume: %d\n", ret);
+ pm_runtime_put(chip->parent);
return ret;
}
}
--
2.17.1


2020-06-05 10:58:27

by Charles Keepax

[permalink] [raw]
Subject: Re: [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case

On Thu, Jun 04, 2020 at 09:52:07PM -0500, Navid Emamdoost 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]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2020-06-10 14:55:05

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case

On Fri, Jun 5, 2020 at 4:52 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]>

Patch applied for fixes.

Yours,
Linus Walleij