media: ti-vpe: Fix a missing check and reference count leak
authorQiushi Wu <wu000273@umn.edu>
Sun, 14 Jun 2020 02:56:05 +0000 (04:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:05:33 +0000 (09:05 +0100)
commitc772cb1c8c15bd5bfb294cf432f902dfd9e7a696
tree1ad5c2585038d5dfdc8b08f9f30bd3ffddf95338
parent3af18152d6802b9f95fc04cd7eec5dc13b6cfe2f
media: ti-vpe: Fix a missing check and reference count leak

[ Upstream commit 7dae2aaaf432767ca7aa11fa84643a7c2600dbdd ]

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: 4571912743ac ("[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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/ti-vpe/vpe.c