Commit 3646ff28 authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher
Browse files

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: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit fae59842)
Cc: stable@vger.kernel.org
parent 2ce75a0b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2690,8 +2690,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;
	}

+1 −1
Original line number Diff line number Diff line
@@ -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);