[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210409025709.181908-1-lujialin4@huawei.com>
Date: Fri, 9 Apr 2021 10:57:09 +0800
From: Lu Jialin <lujialin4@...wei.com>
To: <lujialin4@...wei.com>,
Sylwester Nawrocki <sylvester.nawrocki@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>
CC: <linux-media@...r.kernel.org>, <linux-samsung-soc@...r.kernel.org>,
<kernel-janitors@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Xiu Jianfeng" <xiujianfeng@...wei.com>,
Xiang Yang <xiangyang3@...wei.com>,
"Wang Weiyang" <wangweiyang2@...wei.com>,
Cui GaoSheng <cuigaosheng1@...wei.com>,
Gong Ruiqi <gongruiqi1@...wei.com>
Subject: [PATCH -next] media: s3c-camif: fix PM reference leak in s3c_camif_open()
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@...wei.com>
Signed-off-by: Lu Jialin <lujialin4@...wei.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;
Powered by blists - more mailing lists