drm/amdgpu: fix the waring dereferencing hive
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:33:21 +0000 (09:33 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:33:21 +0000 (09:33 +0000)
From Jesse Zhang
4ab720b6aa1ef5e71db1e534b5b45c80ac4ec58a in linux-6.6.y/6.6.50
1940708ccf5aff76de4e0b399f99267c93a89193 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_psp.c

index d57ba08..5c146c8 100644 (file)
@@ -1336,6 +1336,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;