]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: bail out when failed to load fw in psp_init_cap_microcode()
authorJiang Liu <gerry@linux.alibaba.com>
Fri, 7 Feb 2025 06:28:51 +0000 (14:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 13:01:21 +0000 (14:01 +0100)
[ Upstream commit a0a455b4bc7483ad60e8b8a50330c1e05bb7bfcf ]

In function psp_init_cap_microcode(), it should bail out when failed to
load firmware, otherwise it may cause invalid memory access.

Fixes: 07dbfc6b102e ("drm/amd: Use `amdgpu_ucode_*` helpers for PSP")
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index 0b28b2cf1517d130da01989df70b9dff6433edc4..d70855d7c61c1d326d094fcb648ce62bfd0a241a 100644 (file)
@@ -3713,9 +3713,10 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name)
                if (err == -ENODEV) {
                        dev_warn(adev->dev, "cap microcode does not exist, skip\n");
                        err = 0;
-                       goto out;
+               } else {
+                       dev_err(adev->dev, "fail to initialize cap microcode\n");
                }
-               dev_err(adev->dev, "fail to initialize cap microcode\n");
+               goto out;
        }
 
        info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP];