1
0
Fork 0

media: ti-vpe: Fix a missing check and reference count leak

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code, causing incorrect ref count if
pm_runtime_put_noidle() is not called in error handling paths.
And also, when the call of function vpe_runtime_get() failed,
we won't call vpe_runtime_put().
Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails
inside vpe_runtime_get().

Fixes: 4571912743 ("[media] v4l: ti-vpe: Add VPE mem to mem driver")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
zero-sugar-mainline-defconfig
Qiushi Wu 2020-06-14 04:56:05 +02:00 committed by Mauro Carvalho Chehab
parent 88f50a05f9
commit 7dae2aaaf4
1 changed files with 2 additions and 0 deletions

View File

@ -2475,6 +2475,8 @@ static int vpe_runtime_get(struct platform_device *pdev)
r = pm_runtime_get_sync(&pdev->dev);
WARN_ON(r < 0);
if (r)
pm_runtime_put_noidle(&pdev->dev);
return r < 0 ? r : 0;
}