From: Dan Carpenter <dan.carpenter@oracle.com>
To: tao.zhou1@amd.com
Cc: amd-gfx@lists.freedesktop.org
Subject: [bug report] drm/amdgpu: add function to creat all ras debugfs node
Date: Thu, 12 Mar 2020 10:33:51 +0300 [thread overview]
Message-ID: <20200312073351.GA29451@mwanda> (raw)
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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next reply other threads:[~2020-03-12 7:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 7:33 Dan Carpenter [this message]
2020-03-12 9:18 ` [bug report] drm/amdgpu: add function to creat all ras debugfs node Yang, Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200312073351.GA29451@mwanda \
--to=dan.carpenter@oracle.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=tao.zhou1@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.