linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case
@ 2020-06-05  2:52 Navid Emamdoost
  2020-06-05 10:55 ` Charles Keepax
  2020-06-10  9:18 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Navid Emamdoost @ 2020-06-05  2:52 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, patches, linux-gpio, linux-kernel
  Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case
  2020-06-05  2:52 [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case Navid Emamdoost
@ 2020-06-05 10:55 ` Charles Keepax
  2020-06-10  9:18 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2020-06-05 10:55 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Linus Walleij, Bartosz Golaszewski, patches, linux-gpio,
	linux-kernel, emamd001, wu000273, kjlu, smccaman

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 <navid.emamdoost@gmail.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case
  2020-06-05  2:52 [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case Navid Emamdoost
  2020-06-05 10:55 ` Charles Keepax
@ 2020-06-10  9:18 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-06-10  9:18 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Bartosz Golaszewski, patches, open list:GPIO SUBSYSTEM,
	linux-kernel, Navid Emamdoost, wu000273, Kangjie Lu, smccaman

On Fri, Jun 5, 2020 at 4:52 AM Navid Emamdoost
<navid.emamdoost@gmail.com> 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@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-10  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05  2:52 [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case Navid Emamdoost
2020-06-05 10:55 ` Charles Keepax
2020-06-10  9:18 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).