linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] media: s3c-camif: fix PM reference leak in s3c_camif_open()
@ 2021-04-09  2:57 Lu Jialin
  0 siblings, 0 replies; only message in thread
From: Lu Jialin @ 2021-04-09  2:57 UTC (permalink / raw)
  To: lujialin4, Sylwester Nawrocki, Mauro Carvalho Chehab
  Cc: linux-media, linux-samsung-soc, kernel-janitors, linux-kernel,
	Xiu Jianfeng, Xiang Yang, Wang Weiyang, Cui GaoSheng, Gong Ruiqi

pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Lu Jialin <lujialin4@huawei.com>
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 9ca49af29542..62241ec3b978 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -547,7 +547,7 @@ static int s3c_camif_open(struct file *file)
 	if (ret < 0)
 		goto unlock;
 
-	ret = pm_runtime_get_sync(camif->dev);
+	ret = pm_runtime_resume_and_get(camif->dev);
 	if (ret < 0)
 		goto err_pm;
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09  2:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  2:57 [PATCH -next] media: s3c-camif: fix PM reference leak in s3c_camif_open() Lu Jialin

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