[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210409064658.90493-1-xiangyang3@huawei.com>
Date: Fri, 9 Apr 2021 14:46:58 +0800
From: Xiang Yang <xiangyang3@...wei.com>
To: <xiangyang3@...wei.com>, Jernej Skrabec <jernej.skrabec@...l.net>,
"Mauro Carvalho Chehab" <mchehab@...nel.org>,
Maxime Ripard <mripard@...nel.org>,
Chen-Yu Tsai <wens@...e.org>,
Philipp Zabel <p.zabel@...gutronix.de>
CC: <linux-media@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-sunxi@...ts.linux.dev>, <kernel-janitors@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Hulk Robot <hulkci@...wei.com>
Subject: [PATCH -next] media: sunxi: sun8i-rotate: fix PM reference leak in rotate_start_streaming()
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: Xiang Yang <xiangyang3@...wei.com>
---
.../platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c
index 3f81dd17755c..fbcca59a0517 100644
--- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c
+++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c
@@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count)
struct device *dev = ctx->dev->dev;
int ret;
- ret = pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0) {
dev_err(dev, "Failed to enable module\n");
Powered by blists - more mailing lists