drm/amdkfd: fix ref count leak when pm_runtime_get_sync fails
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jun 2020 18:52:07 +0000 (14:52 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:17 +0000 (11:29 +0200)
commit4e302836dc790a64fc4e9136db63c72a9cde252d
tree633afadf0737c063e04226ffd815ff08d002cf5c
parent2e91283fdb45ffefec70112db98f5bb5619125e1
drm/amdkfd: fix ref count leak when pm_runtime_get_sync fails

[ Upstream commit 1c1ada37af6ee6fb9cfc8da6a56cc83208cd8d6f ]

The call to pm_runtime_get_sync increments the counter even in case of
failure, leading to incorrect ref count.
In case of failure, decrement the ref count before returning.

Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdkfd/kfd_process.c