drm/amdgpu/pm: fix ref count leak when pm_runtime_get_sync fails
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jun 2020 18:43:08 +0000 (14:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:18 +0000 (11:29 +0200)
commit04cde704f3295047ac7d2e2859b5bf5075e3c76a
tree86b77f0dc880ee5941ab9f77cba550a0ee0b28f9
parent4e302836dc790a64fc4e9136db63c72a9cde252d
drm/amdgpu/pm: fix ref count leak when pm_runtime_get_sync fails

[ Upstream commit 66429300e1bd9cdfbe96cfc475e4964db2a36921 ]

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: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c