linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: platform: sti: hva: Fix runtime PM imbalance on error
@ 2020-05-21 10:05 Dinghao Liu
  2020-06-08 13:31 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-21 10:05 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Jean-Christophe Trotin, Mauro Carvalho Chehab, linux-media, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

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

diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c
index 401aaafa1710..8533d3bc6d5c 100644
--- a/drivers/media/platform/sti/hva/hva-hw.c
+++ b/drivers/media/platform/sti/hva/hva-hw.c
@@ -388,7 +388,7 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva)
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
 		dev_err(dev, "%s     failed to set PM\n", HVA_PREFIX);
-		goto err_clk;
+		goto err_pm;
 	}
 
 	/* check IP hardware version */
-- 
2.17.1


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

* Re: [PATCH] media: platform: sti: hva: Fix runtime PM imbalance on error
  2020-05-21 10:05 [PATCH] media: platform: sti: hva: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-06-08 13:31 ` Hans Verkuil
  2020-06-09  1:30   ` dinghao.liu
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2020-06-08 13:31 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Jean-Christophe Trotin, Mauro Carvalho Chehab, linux-media, linux-kernel

On 21/05/2020 12:05, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/media/platform/sti/hva/hva-hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c
> index 401aaafa1710..8533d3bc6d5c 100644
> --- a/drivers/media/platform/sti/hva/hva-hw.c
> +++ b/drivers/media/platform/sti/hva/hva-hw.c
> @@ -388,7 +388,7 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva)
>  	ret = pm_runtime_get_sync(dev);
>  	if (ret < 0) {
>  		dev_err(dev, "%s     failed to set PM\n", HVA_PREFIX);
> -		goto err_clk;
> +		goto err_pm;
>  	}
>  
>  	/* check IP hardware version */
> 

err_pm:
        pm_runtime_put(dev);

Shouldn't that be pm_runtime_put_sync()?

I'm not pm expert, but it does look odd.

Regards,

	Hans

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

* Re: Re: [PATCH] media: platform: sti: hva: Fix runtime PM imbalance on error
  2020-06-08 13:31 ` Hans Verkuil
@ 2020-06-09  1:30   ` dinghao.liu
  0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-06-09  1:30 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: kjlu, Jean-Christophe Trotin, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Hi Hans,
> err_pm:
>         pm_runtime_put(dev);
> 
> Shouldn't that be pm_runtime_put_sync()?
> 
> I'm not pm expert, but it does look odd.
> 

I checked the implementation of these two APIs before
and found they were exactly the same. So I think it's
fine to keep using pm_runtime_put().

Regards,
Dinghao

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

end of thread, other threads:[~2020-06-09  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 10:05 [PATCH] media: platform: sti: hva: Fix runtime PM imbalance on error Dinghao Liu
2020-06-08 13:31 ` Hans Verkuil
2020-06-09  1:30   ` dinghao.liu

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