]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd: Set num IP blocks to 0 if discovery fails
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 10 Mar 2026 16:58:22 +0000 (11:58 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 Mar 2026 17:58:08 +0000 (13:58 -0400)
If discovery has failed for any reason (such as no support for a block)
then there is no need to unwind all the IP blocks in fini. In this
condition there can actually be failures during the unwind too.

Reset num_ip_blocks to zero during failure path and skip the unnecessary
cleanup path.

Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

index 99e5d1e0bf3c862ed7f809adc0d969d8a652ebe4..711b4502653a2081563ad1d3df670986137b1032 100644 (file)
@@ -1995,8 +1995,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
                break;
        default:
                r = amdgpu_discovery_set_ip_blocks(adev);
-               if (r)
+               if (r) {
+                       adev->num_ip_blocks = 0;
                        return r;
+               }
                break;
        }
 
index 77e2133de5cf9173c0d218ffee7f04bb01f58855..7f19554b9ad11dc35c53d0dfe4bc46f65dc74b81 100644 (file)
@@ -83,7 +83,7 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
 {
        struct amdgpu_device *adev = drm_to_adev(dev);
 
-       if (adev == NULL)
+       if (adev == NULL || !adev->num_ip_blocks)
                return;
 
        amdgpu_unregister_gpu_instance(adev);