drm/amdgpu: fix pci device refcount leak
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 17 Nov 2022 15:00:03 +0000 (23:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:11 +0000 (13:14 +0100)
commit02105f0b3021ee5853b2fa50853c42f35fc01cfd
tree99db0ada86cf0463044b9ba870dc1e7a35c5c5e1
parent5b0a1f1247cd42ac5e0d369f8dbb58762692edee
drm/amdgpu: fix pci device refcount leak

[ Upstream commit b85e285e3d6352b02947fc1b72303673dfacb0aa ]

As comment of pci_get_domain_bus_and_slot() says, it returns
a pci device with refcount increment, when finish using it,
the caller must decrement the reference count by calling
pci_dev_put().

So before returning from amdgpu_device_resume|suspend_display_audio(),
pci_dev_put() is called to avoid refcount leak.

Fixes: 3f12acc8d6d4 ("drm/amdgpu: put the audio codec into suspend state before gpu reset V3")
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c