Hi Alex,
On 01/10/2026 22:14, Alex Hung wrote:
Hi Tvrtko,
Building this patchset with clang generated the following errors:
Thank you for trying it out. Apparently I was too eager with some local
variable removals.
Fixed in v3 just sent as a reply to the original.
Regards,
Tvrtko
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.o
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1516:6: error: variable 'crtc' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1516 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1541:6: note: uninitialized use occurs here
1541 | if (crtc)
| ^~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1516:2: note: remove the 'if' if its condition is
always false
1516 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1517 | goto unlock;
| ~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1492:23: note: initialize the variable 'crtc' to
silence this warning
1492 | struct drm_crtc *crtc;
| ^
| = NULL
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1674:6: error: variable 'crtc' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1674 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1699:6: note: uninitialized use occurs here
1699 | if (crtc)
| ^~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1674:2: note: remove the 'if' if its condition is
always false
1674 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1675 | goto unlock;
| ~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1650:23: note: initialize the variable 'crtc' to
silence this warning
1650 | struct drm_crtc *crtc;
| ^
| = NULL
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1832:6: error: variable 'crtc' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1832 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1857:6: note: uninitialized use occurs here
1857 | if (crtc)
| ^~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1832:2: note: remove the 'if' if its condition is
always false
1832 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1833 | goto unlock;
| ~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1808:23: note: initialize the variable 'crtc' to
silence this warning
1808 | struct drm_crtc *crtc;
| ^
| = NULL
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1983:6: error: variable 'crtc' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1983 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:2003:6: note: uninitialized use occurs here
2003 | if (crtc)
| ^~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1983:2: note: remove the 'if' if its condition is
always false
1983 | if (connector->state == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1984 | goto unlock;
| ~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/
amdgpu_dm_debugfs.c:1959:23: note: initialize the variable 'crtc' to
silence this warning
1959 | struct drm_crtc *crtc;
| ^
| = NULL
4 errors generated.
make[6]: *** [scripts/Makefile.build:289: drivers/gpu/drm/amd/amdgpu/../
display/amdgpu_dm/amdgpu_dm_debugfs.o] Error 1
make[5]: *** [scripts/Makefile.build:548: drivers/gpu/drm/amd/amdgpu]
Error 2
make[4]: *** [scripts/Makefile.build:548: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:548: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:548: drivers] Error 2
make[1]: *** [/home/alexhung/develop/amd/amdgpu/Makefile:2144: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
On 9/24/26 07:40, Tvrtko Ursulin wrote:
I had some patches in this area ages ago so I re-visited them, tweaked
and
decided to re-post.
First is a clear fix while second is a serious refactor which needs a
lot of
scrutiny. Mostly closing in on the desired semantics and thinking whether
changing any of the existing (incosistent) semantics is likely to
break any
(hypothetical) scripts used for debugfs configuration. In it probably
desirable
in principle since it removes a lot of redundant and somewhat
questionable code.
Cc: Harry Wentland <[email protected]>
Cc: Leo Li <[email protected]>
Cc: Timur Kristóf <[email protected]>
Tvrtko Ursulin (2):
drm/amd/display: Use memdup_user_nul in debugfs code
drm/amd/display: Simplify debugfs token parsing
.../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 600 ++++--------------
1 file changed, 130 insertions(+), 470 deletions(-)