drm/amdgpu: Avoid printing of stack contents on firmware load error
authorJiri Kosina <jkosina@suse.cz>
Thu, 24 Jun 2021 11:11:36 +0000 (13:11 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 26 Jul 2021 16:43:03 +0000 (12:43 -0400)
commit6aade587d329ebe88319dfdb8e8c7b6aede80417
tree6458327d34b03eee38645c3aceccddce20e46eb4
parentd47255d3f87338164762ac56df1f28d751e27246
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 <vojtech@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c