From: Tim Huang <Tim.Huang@xxxxxxx> Clear warning that uses uninitialized value fw_size. Signed-off-by: Tim Huang <Tim.Huang@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index d95555dc5485..8d5cdbb99d8d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -1084,7 +1084,7 @@ void amdgpu_gfx_cp_init_microcode(struct amdgpu_device *adev, const struct gfx_firmware_header_v2_0 *cp_hdr_v2_0; struct amdgpu_firmware_info *info = NULL; const struct firmware *ucode_fw; - unsigned int fw_size; + unsigned int fw_size = 0; switch (ucode_id) { case AMDGPU_UCODE_ID_CP_PFP: @@ -1205,7 +1205,8 @@ void amdgpu_gfx_cp_init_microcode(struct amdgpu_device *adev, fw_size = le32_to_cpu(cp_hdr_v2_0->data_size_bytes); break; default: - break; + dev_err(adev->dev, "Invalid ucode id %u\n", ucode_id); + return; } if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { -- 2.39.2