[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210430174413.0000452c@Huawei.com>
Date: Fri, 30 Apr 2021 17:44:13 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
CC: <linuxarm@...wei.com>, <mauro.chehab@...wei.com>,
Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Tiffany Lin <tiffany.lin@...iatek.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-media@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v4 16/79] media: mtk-vcodec: fix pm_runtime_get_sync()
usage count
On Wed, 28 Apr 2021 16:51:37 +0200
Mauro Carvalho Chehab <mchehab+huawei@...nel.org> wrote:
> The pm_runtime_get_sync() internally increments the
> dev->power.usage_count without decrementing it, even on errors.
> Replace it by the new pm_runtime_resume_and_get(), introduced by:
> commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
> in order to properly decrement the usage counter and avoid memory
> leaks.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Without a return value, this seems like it's not complete as driver
will carry on and eventually call mtk_vcode_dec_pw_off() which will assume
it needs to decrement the count.
> ---
> drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> index ddee7046ce42..fe096fe61c9d 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> @@ -92,9 +92,9 @@ void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
> {
> int ret;
>
> - ret = pm_runtime_get_sync(pm->dev);
> + ret = pm_runtime_resume_and_get(pm->dev);
> if (ret)
> - mtk_v4l2_err("pm_runtime_get_sync fail %d", ret);
> + mtk_v4l2_err("pm_runtime_resume_and_get fail %d", ret);
> }
>
> void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
Powered by blists - more mailing lists