gfx_v8_0_init_microcode() allocates rlc.register_list_format before
loading the MEC firmware.

If loading one of the subsequent firmware files fails, the function
returns through the error path without freeing register_list_format.

Use gfx_v8_0_free_microcode() in the error path so all previously
allocated firmware resources, including register_list_format, are
released.

Signed-off-by: Willian Oliveira <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 7f91186ef1d1..b213870ecb96 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1211,12 +1211,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device 
*adev)
 out:
        if (err) {
                dev_err(adev->dev, "gfx8: Failed to load firmware %s gfx 
firmware\n", chip_name);
-               amdgpu_ucode_release(&adev->gfx.pfp_fw);
-               amdgpu_ucode_release(&adev->gfx.me_fw);
-               amdgpu_ucode_release(&adev->gfx.ce_fw);
-               amdgpu_ucode_release(&adev->gfx.rlc_fw);
-               amdgpu_ucode_release(&adev->gfx.mec_fw);
-               amdgpu_ucode_release(&adev->gfx.mec2_fw);
+               gfx_v8_0_free_microcode(adev);
        }
        return err;
 }
-- 
2.47.3

Reply via email to