mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: qcom: iris: fix runtime PM reference leaks
@ 2026-06-04  0:44 Hungyu Lin
  2026-06-04  2:00 ` Jie Gan
  0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-06-04  0:44 UTC (permalink / raw)
  To: vikash.garodia, dikshita.agarwal, abhinav.kumar, bod, mchehab
  Cc: linux-media, linux-arm-msm, linux-kernel, Hungyu Lin

Use pm_runtime_resume_and_get() in iris_enable_power_domains()
to avoid leaking a runtime PM usage count on failure.

Also ensure pm_runtime_put_sync() is always called in
iris_disable_power_domains(), even when iris_opp_set_rate()
fails, so runtime PM references remain balanced.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/media/platform/qcom/iris/iris_resources.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
index 773f6548370a..f5e3341e1430 100644
--- a/drivers/media/platform/qcom/iris/iris_resources.c
+++ b/drivers/media/platform/qcom/iris/iris_resources.c
@@ -78,11 +78,11 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)
 	if (ret)
 		return ret;
 
-	ret = pm_runtime_get_sync(pd_dev);
-	if (ret < 0)
+	ret = pm_runtime_resume_and_get(pd_dev);
+	if (ret)
 		return ret;
 
-	return ret;
+	return 0;
 }
 
 int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
@@ -90,12 +90,10 @@ int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
 	int ret;
 
 	ret = iris_opp_set_rate(core->dev, 0);
-	if (ret)
-		return ret;
 
 	pm_runtime_put_sync(pd_dev);
 
-	return 0;
+	return ret;
 }
 
 static struct clk *iris_get_clk_by_type(struct iris_core *core, enum platform_clk_type clk_type)
-- 
2.34.1


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

* Re: [PATCH] media: qcom: iris: fix runtime PM reference leaks
  2026-06-04  0:44 [PATCH] media: qcom: iris: fix runtime PM reference leaks Hungyu Lin
@ 2026-06-04  2:00 ` Jie Gan
  0 siblings, 0 replies; 2+ messages in thread
From: Jie Gan @ 2026-06-04  2:00 UTC (permalink / raw)
  To: Hungyu Lin, vikash.garodia, dikshita.agarwal, abhinav.kumar, bod,
	mchehab
  Cc: linux-media, linux-arm-msm, linux-kernel



On 6/4/2026 8:44 AM, Hungyu Lin wrote:
> Use pm_runtime_resume_and_get() in iris_enable_power_domains()
> to avoid leaking a runtime PM usage count on failure.
> 
> Also ensure pm_runtime_put_sync() is always called in
> iris_disable_power_domains(), even when iris_opp_set_rate()
> fails, so runtime PM references remain balanced.
> 

Please add a fix tag for the fix patch.

Fixes: bb8a95aa038e ("media: iris: implement power management")

Thanks,
Jie

> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
>   drivers/media/platform/qcom/iris/iris_resources.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
> index 773f6548370a..f5e3341e1430 100644
> --- a/drivers/media/platform/qcom/iris/iris_resources.c
> +++ b/drivers/media/platform/qcom/iris/iris_resources.c
> @@ -78,11 +78,11 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)
>   	if (ret)
>   		return ret;
>   
> -	ret = pm_runtime_get_sync(pd_dev);
> -	if (ret < 0)
> +	ret = pm_runtime_resume_and_get(pd_dev);
> +	if (ret)
>   		return ret;
>   
> -	return ret;
> +	return 0;
>   }
>   
>   int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
> @@ -90,12 +90,10 @@ int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
>   	int ret;
>   
>   	ret = iris_opp_set_rate(core->dev, 0);
> -	if (ret)
> -		return ret;
>   
>   	pm_runtime_put_sync(pd_dev);
>   
> -	return 0;
> +	return ret;
>   }
>   
>   static struct clk *iris_get_clk_by_type(struct iris_core *core, enum platform_clk_type clk_type)


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

end of thread, other threads:[~2026-06-04  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-04  0:44 [PATCH] media: qcom: iris: fix runtime PM reference leaks Hungyu Lin
2026-06-04  2:00 ` Jie Gan

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®