mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lu Jialin <lujialin4@huawei.com>
To: <lujialin4@huawei.com>,
	Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: <linux-media@vger.kernel.org>,
	<linux-samsung-soc@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Xiu Jianfeng" <xiujianfeng@huawei.com>,
	Xiang Yang <xiangyang3@huawei.com>,
	"Wang Weiyang" <wangweiyang2@huawei.com>,
	Cui GaoSheng <cuigaosheng1@huawei.com>,
	Gong Ruiqi <gongruiqi1@huawei.com>
Subject: [PATCH -next] media: s3c-camif: fix PM reference leak in s3c_camif_open()
Date: Fri, 9 Apr 2021 10:57:09 +0800	[thread overview]
Message-ID: <20210409025709.181908-1-lujialin4@huawei.com> (raw)

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;
 


                 reply	other threads:[~2021-04-09  2:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210409025709.181908-1-lujialin4@huawei.com \
    --to=lujialin4@huawei.com \
    --cc=cuigaosheng1@huawei.com \
    --cc=gongruiqi1@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sylvester.nawrocki@gmail.com \
    --cc=wangweiyang2@huawei.com \
    --cc=xiangyang3@huawei.com \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®