Skip to content

Commit 3646ff2

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Set num IP blocks to 0 if discovery fails
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> (cherry picked from commit fae5984) Cc: stable@vger.kernel.org
1 parent 2ce75a0 commit 3646ff2

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2690,8 +2690,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
26902690
break;
26912691
default:
26922692
r = amdgpu_discovery_set_ip_blocks(adev);
2693-
if (r)
2693+
if (r) {
2694+
adev->num_ip_blocks = 0;
26942695
return r;
2696+
}
26952697
break;
26962698
}
26972699

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
8383
{
8484
struct amdgpu_device *adev = drm_to_adev(dev);
8585

86-
if (adev == NULL)
86+
if (adev == NULL || !adev->num_ip_blocks)
8787
return;
8888

8989
amdgpu_unregister_gpu_instance(adev);

0 commit comments

Comments
 (0)