drm/amdgpu: fix the waring dereferencing hive
authorJesse Zhang <jesse.zhang@amd.com>
Wed, 8 May 2024 08:20:49 +0000 (16:20 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 May 2024 20:11:53 +0000 (16:11 -0400)
Check the amdgpu_hive_info *hive that maybe is NULL.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index 37820dd..5a648a6 100644 (file)
@@ -1362,6 +1362,9 @@ static void psp_xgmi_reflect_topology_info(struct psp_context *psp,
        uint8_t dst_num_links = node_info.num_links;
 
        hive = amdgpu_get_xgmi_hive(psp->adev);
+       if (WARN_ON(!hive))
+               return;
+
        list_for_each_entry(mirror_adev, &hive->device_list, gmc.xgmi.head) {
                struct psp_xgmi_topology_info *mirror_top_info;
                int j;