As comment of pci_get_class() says, it returns a pci_device with its refcount increased and decreased the refcount for the input parameter @from if it is not NULL. If we use pci_get_class() to iterate all the PCI device of a certain class, when we find the expected device and break the iteration loop, the refcount of the found PCI device is increased. When finish using the PCI device, we need to call pci_dev_put() to decrease the refcount. Xiongfeng Wang (2): drm/radeon: Fix PCI device refcount leak in radeon_atrm_get_bios() drm/amdgpu: Fix PCI device refcount leak in amdgpu_atrm_get_bios() drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 1 + drivers/gpu/drm/radeon/radeon_bios.c | 1 + 2 files changed, 2 insertions(+) -- 2.20.1