linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: platform: sti: Fix rumtime PM imbalance in regs_show
@ 2021-04-07  5:43 Dinghao Liu
  2021-04-07 13:58 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2021-04-07  5:43 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Fabien Dessenne, Mauro Carvalho Chehab, linux-media, linux-kernel

pm_runtime_get_sync() will increase the rumtime PM counter
even it returns an error. Thus a pairing decrement is needed
to prevent refcount leak. Fix this by replacing this API with
pm_runtime_resume_and_get(), which will not change the runtime
PM counter on error.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/media/platform/sti/bdisp/bdisp-debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/sti/bdisp/bdisp-debug.c b/drivers/media/platform/sti/bdisp/bdisp-debug.c
index 2b270093009c..a27f638df11c 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-debug.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-debug.c
@@ -480,7 +480,7 @@ static int regs_show(struct seq_file *s, void *data)
 	int ret;
 	unsigned int i;
 
-	ret = pm_runtime_get_sync(bdisp->dev);
+	ret = pm_runtime_resume_and_get(bdisp->dev);
 	if (ret < 0) {
 		seq_puts(s, "Cannot wake up IP\n");
 		return 0;
-- 
2.17.1


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

* Re: [PATCH] media: platform: sti: Fix rumtime PM imbalance in regs_show
  2021-04-07  5:43 [PATCH] media: platform: sti: Fix rumtime PM imbalance in regs_show Dinghao Liu
@ 2021-04-07 13:58 ` Hans Verkuil
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2021-04-07 13:58 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Fabien Dessenne, Mauro Carvalho Chehab, linux-media, linux-kernel

On 07/04/2021 07:43, Dinghao Liu wrote:
> pm_runtime_get_sync() will increase the rumtime PM counter
> even it returns an error. Thus a pairing decrement is needed
> to prevent refcount leak. Fix this by replacing this API with
> pm_runtime_resume_and_get(), which will not change the runtime
> PM counter on error.

Nice that a new function was created for this. Good news.

Just a heads up: if you make more patches like this, make sure you
fix the typo 'rumtime' to 'runtime'. I'll fix it manually, no need
to repost. And 'rumtime' does sound tasty!

Regards,

	Hans

> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/media/platform/sti/bdisp/bdisp-debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-debug.c b/drivers/media/platform/sti/bdisp/bdisp-debug.c
> index 2b270093009c..a27f638df11c 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-debug.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-debug.c
> @@ -480,7 +480,7 @@ static int regs_show(struct seq_file *s, void *data)
>  	int ret;
>  	unsigned int i;
>  
> -	ret = pm_runtime_get_sync(bdisp->dev);
> +	ret = pm_runtime_resume_and_get(bdisp->dev);
>  	if (ret < 0) {
>  		seq_puts(s, "Cannot wake up IP\n");
>  		return 0;
> 


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

end of thread, other threads:[~2021-04-07 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  5:43 [PATCH] media: platform: sti: Fix rumtime PM imbalance in regs_show Dinghao Liu
2021-04-07 13:58 ` Hans Verkuil

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).