drm/amd: Fix a probing order problem on SDMA 2.4
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 12 Dec 2023 07:09:16 +0000 (01:09 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 13 Dec 2023 20:28:55 +0000 (15:28 -0500)
commit 751e293f2c99 ("drm/amd: Move microcode init from sw_init to
early_init for SDMA v2.4") made a fateful mistake in
`adev->sdma.num_instances` wasn't declared when sdma_v2_4_init_microcode()
was run. This caused probing to fail.

Move the declaration to right before sdma_v2_4_init_microcode().

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3043
Fixes: 751e293f2c99 ("drm/amd: Move microcode init from sw_init to early_init for SDMA v2.4")
Reviewed-by: Alex Deucher <alexander.deucher@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/sdma_v2_4.c

index 45377a1752503b6d69b632b42a78036b524f2f7a..8d5d86675a7fea5e4e5e8bc4e49cdbb580ae17a6 100644 (file)
@@ -813,12 +813,12 @@ static int sdma_v2_4_early_init(void *handle)
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
        int r;
 
+       adev->sdma.num_instances = SDMA_MAX_INSTANCE;
+
        r = sdma_v2_4_init_microcode(adev);
        if (r)
                return r;
 
-       adev->sdma.num_instances = SDMA_MAX_INSTANCE;
-
        sdma_v2_4_set_ring_funcs(adev);
        sdma_v2_4_set_buffer_funcs(adev);
        sdma_v2_4_set_vm_pte_funcs(adev);