]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/amdgpu: check rlc_g firmware pointer is valid before using it
authorshaoyunl <shaoyun.liu@amd.com>
Fri, 10 Jan 2020 18:27:23 +0000 (13:27 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 16 Jan 2020 18:35:17 +0000 (13:35 -0500)
In SRIOV, rlc_g firmware is loaded by host, guest driver won't load it which will
cause the rlc_fw pointer is null

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

index 1a500bbcdd1d2ed2dfa3a3b34e544faaeeb1c128..95f56b541e750b21bd36c21349abeaff4b53b806 100644 (file)
@@ -822,10 +822,11 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
                info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
                info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
                info->fw = adev->gfx.rlc_fw;
-               header = (const struct common_firmware_header *)info->fw->data;
-               adev->firmware.fw_size +=
-                       ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
-
+               if (info->fw) {
+                       header = (const struct common_firmware_header *)info->fw->data;
+                       adev->firmware.fw_size +=
+                               ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
+               }
                if (adev->gfx.rlc.is_rlc_v2_1 &&
                    adev->gfx.rlc.save_restore_list_cntl_size_bytes &&
                    adev->gfx.rlc.save_restore_list_gpm_size_bytes &&