[PATCH] drm/amdgpu: Fix incorrect resource realease in amdgpu_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If pci_register_driver() fails, amdgpu_sync_slab and amdgpu_fence_slab
should be freed in the error path, fix it.

Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 094498a0964b..3e73306a883d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -3046,7 +3046,14 @@ static int __init amdgpu_init(void)
 	amdgpu_amdkfd_init();
 
 	/* let modprobe override vga console setting */
-	return pci_register_driver(&amdgpu_kms_pci_driver);
+	r = pci_register_driver(&amdgpu_kms_pci_driver);
+	if (r)
+		goto error_pci_register;
+
+	return 0;
+
+error_pci_register:
+	amdgpu_fence_slab_fini();
 
 error_fence:
 	amdgpu_sync_fini();
-- 
2.34.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux