Skip to content

Commit ca54639

Browse files
fenghusthualexdeucher
authored andcommitted
drm/amdgpu: Fix PCI device refcount leak in amdgpu_atrm_get_bios()
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 break the loop in amdgpu_atrm_get_bios() with 'pdev' not NULL, we need to call pci_dev_put() to decrease the refcount. Add the missing pci_dev_put() to avoid refcount leak. Fixes: d38ceaf ("drm/amdgpu: add core driver (v4)") Signed-off-by: Xiongfeng Wang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent abcb2ac commit ca54639

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
317317

318318
if (!found)
319319
return false;
320+
pci_dev_put(pdev);
320321

321322
adev->bios = kmalloc(size, GFP_KERNEL);
322323
if (!adev->bios) {

0 commit comments

Comments
 (0)