Commit c1509f3f authored by Stanley.Yang's avatar Stanley.Yang Committed by Alex Deucher

drm/amdgpu: fix warning in ras_debugfs_create_all()

Fix the warning
"warn: variable dereferenced before check 'obj' (see line 1131)"
by removing unnecessary checks as amdgpu_ras_debugfs_create_all()
is only called from amdgpu_debugfs_init() where obj member in
con->head list is not NULL.
Use list_for_each_entry() instead list_for_each_entry_safe() as obj
do not to be freeing or removing from list during this process.
Signed-off-by: default avatarStanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 565d1941
...@@ -1116,7 +1116,7 @@ void amdgpu_ras_debugfs_create(struct amdgpu_device *adev, ...@@ -1116,7 +1116,7 @@ void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
{ {
struct amdgpu_ras *con = amdgpu_ras_get_context(adev); struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
struct ras_manager *obj, *tmp; struct ras_manager *obj;
struct ras_fs_if fs_info; struct ras_fs_if fs_info;
/* /*
...@@ -1128,10 +1128,7 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) ...@@ -1128,10 +1128,7 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
amdgpu_ras_debugfs_create_ctrl_node(adev); amdgpu_ras_debugfs_create_ctrl_node(adev);
list_for_each_entry_safe(obj, tmp, &con->head, node) { list_for_each_entry(obj, &con->head, node) {
if (!obj)
continue;
if (amdgpu_ras_is_supported(adev, obj->head.block) && if (amdgpu_ras_is_supported(adev, obj->head.block) &&
(obj->attr_inuse == 1)) { (obj->attr_inuse == 1)) {
sprintf(fs_info.debugfs_name, "%s_err_inject", sprintf(fs_info.debugfs_name, "%s_err_inject",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment