Hello Tao Zhou, The patch f9317014ea51: "drm/amdgpu: add function to creat all ras debugfs node" from Mar 6, 2020, leads to the following static checker warning: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1132 amdgpu_ras_debugfs_create_all() warn: variable dereferenced before check 'obj' (see line 1131) drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 1116 void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) 1117 { 1118 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 1119 struct ras_manager *obj, *tmp; 1120 struct ras_fs_if fs_info; 1121 1122 /* 1123 * it won't be called in resume path, no need to check 1124 * suspend and gpu reset status 1125 */ 1126 if (!con) 1127 return; 1128 1129 amdgpu_ras_debugfs_create_ctrl_node(adev); 1130 1131 list_for_each_entry_safe(obj, tmp, &con->head, node) { 1132 if (!obj) ^^^^ There is no need to check for NULL here, so just remove the check. The other question is why is this using list_for_each_entry_safe() instead of vanilla list_for_each_entry()? It doesn't seem to be freeing "obj" or removing "obj" from the list which are basically the only reasons why _safe() is used. Some people think _safe() has something to do with locking but it doesn't. Please remove the test and use vanilla list_for_each_entry(). 1133 continue; 1134 1135 if (amdgpu_ras_is_supported(adev, obj->head.block) && 1136 (obj->attr_inuse == 1)) { 1137 sprintf(fs_info.debugfs_name, "%s_err_inject", 1138 ras_block_str(obj->head.block)); 1139 fs_info.head = obj->head; 1140 amdgpu_ras_debugfs_create(adev, &fs_info); 1141 } 1142 } 1143 } regards, dan carpenter _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx