Skip to content

Commit 6aade58

Browse files
Jiri Kosinaalexdeucher
authored andcommitted
drm/amdgpu: Avoid printing of stack contents on firmware load error
In case when psp_init_asd_microcode() fails to load ASD microcode file, psp_v12_0_init_microcode() tries to print the firmware filename that failed to load before bailing out. This is wrong because: - the firmware filename it would want it print is an incorrect one as psp_init_asd_microcode() and psp_v12_0_init_microcode() are loading different filenames - it tries to print fw_name, but that's not yet been initialized by that time, so it prints random stack contents, e.g. amdgpu 0000:04:00.0: Direct firmware load for amdgpu/renoir_asd.bin failed with error -2 amdgpu 0000:04:00.0: amdgpu: fail to initialize asd microcode amdgpu 0000:04:00.0: amdgpu: psp v12.0: Failed to load firmware "\xfeTO\x8e\xff\xff" Fix that by bailing out immediately, instead of priting the bogus error message. Reported-by: Vojtech Pavlik <[email protected]> Signed-off-by: Jiri Kosina <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent d47255d commit 6aade58

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)
6767

6868
err = psp_init_asd_microcode(psp, chip_name);
6969
if (err)
70-
goto out;
70+
return err;
7171

7272
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
7373
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
@@ -80,7 +80,7 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)
8080
} else {
8181
err = amdgpu_ucode_validate(adev->psp.ta_fw);
8282
if (err)
83-
goto out2;
83+
goto out;
8484

8585
ta_hdr = (const struct ta_firmware_header_v1_0 *)
8686
adev->psp.ta_fw->data;
@@ -105,10 +105,9 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)
105105

106106
return 0;
107107

108-
out2:
108+
out:
109109
release_firmware(adev->psp.ta_fw);
110110
adev->psp.ta_fw = NULL;
111-
out:
112111
if (err) {
113112
dev_err(adev->dev,
114113
"psp v12.0: Failed to load firmware \"%s\"\n",

0 commit comments

Comments
 (0)