linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance in s3c_camif_open
@ 2020-05-22  8:29 Dinghao Liu
  2020-09-17 11:26 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-05-22  8:29 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Sylwester Nawrocki, Mauro Carvalho Chehab, linux-media,
	linux-samsung-soc, 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.

Also, call pm_runtime_put() and v4l2_fh_release() when sensor_set_power()
returns an error code.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/media/platform/s3c-camif/camif-capture.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 9ca49af29542..d42d9cfaf674 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -552,11 +552,9 @@ static int s3c_camif_open(struct file *file)
 		goto err_pm;
 
 	ret = sensor_set_power(camif, 1);
-	if (!ret)
-		goto unlock;
 
-	pm_runtime_put(camif->dev);
 err_pm:
+	pm_runtime_put(camif->dev);
 	v4l2_fh_release(file);
 unlock:
 	mutex_unlock(&camif->lock);
-- 
2.17.1


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

end of thread, other threads:[~2020-09-17 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  8:29 [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance in s3c_camif_open Dinghao Liu
2020-09-17 11:26 ` 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).