mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mfd: arizona: handle pm_runtime_get_sync failure case
@ 2020-06-05  2:47 Navid Emamdoost
  2020-06-05 10:55 ` Charles Keepax
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2020-06-05  2:47 UTC (permalink / raw)
  To: Lee Jones, patches, 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_sync if
pm_runtime_get_sync fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/mfd/arizona-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index f73cf76d1373..5b3191b6534a 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -46,8 +46,10 @@ int arizona_clk32k_enable(struct arizona *arizona)
 		switch (arizona->pdata.clk32k_src) {
 		case ARIZONA_32KZ_MCLK1:
 			ret = pm_runtime_get_sync(arizona->dev);
-			if (ret != 0)
+			if (ret != 0) {
+				pm_runtime_put_sync(arizona->dev);
 				goto err_ref;
+			}
 			ret = clk_prepare_enable(arizona->mclk[ARIZONA_MCLK1]);
 			if (ret != 0) {
 				pm_runtime_put_sync(arizona->dev);
-- 
2.17.1


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

* Re: [PATCH] mfd: arizona: handle pm_runtime_get_sync failure case
  2020-06-05  2:47 [PATCH] mfd: arizona: handle pm_runtime_get_sync failure case Navid Emamdoost
@ 2020-06-05 10:55 ` Charles Keepax
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2020-06-05 10:55 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Lee Jones, patches, linux-kernel, emamd001, wu000273, kjlu, smccaman

On Thu, Jun 04, 2020 at 09:47:13PM -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_sync 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] 2+ messages in thread

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

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®