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)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Jul 2020 05:59:23 +0000 (01:59 -0400)
commit66429300e1bd9cdfbe96cfc475e4964db2a36921
tree1a8bd69339c9f881c9c02e467ef3b6426ad05a1c
parent9eee152aab56d374edb9ad21b3db05f5cdda2fe6
drm/amdgpu/pm: fix ref count leak when pm_runtime_get_sync fails

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>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c