drm/amdgpu: refine gfx7 firmware loading
authorYang Wang <kevinyang.wang@amd.com>
Fri, 31 May 2024 06:10:58 +0000 (14:10 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:17:15 +0000 (16:17 -0400)
refine gfx7 firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

index 8f19b6a..d845891 100644 (file)
@@ -909,7 +909,6 @@ static void gfx_v7_0_free_microcode(struct amdgpu_device *adev)
 static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
 {
        const char *chip_name;
-       char fw_name[30];
        int err;
 
        DRM_DEBUG("\n");
@@ -934,38 +933,38 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
                BUG();
        }
 
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
-       err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
+       err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  "amdgpu/%s_pfp.bin", chip_name);
        if (err)
                goto out;
 
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
-       err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
+       err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  "amdgpu/%s_me.bin", chip_name);
        if (err)
                goto out;
 
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
-       err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
+       err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  "amdgpu/%s_ce.bin", chip_name);
        if (err)
                goto out;
 
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
-       err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
+       err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  "amdgpu/%s_mec.bin", chip_name);
        if (err)
                goto out;
 
        if (adev->asic_type == CHIP_KAVERI) {
-               snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
-               err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
+               err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                          "amdgpu/%s_mec2.bin", chip_name);
                if (err)
                        goto out;
        }
 
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
-       err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
+       err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  "amdgpu/%s_rlc.bin", chip_name);
 out:
        if (err) {
-               pr_err("gfx7: Failed to load firmware \"%s\"\n", fw_name);
+               pr_err("gfx7: Failed to load firmware %s gfx firmware\n", chip_name);
                gfx_v7_0_free_microcode(adev);
        }
        return err;