Nonsensical code in AMD GPU driver |
|||||
Issue description
gcc 7.2 complains when compiling AMD GPU code in chromeos-4.14.
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_math.c: In function 'dcn_bw_max':
>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_math.c:48:11: warning: self-comparison always evaluates to false [-Wtautological-compare]
if (arg1 != arg1)
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_math.c:50:11: warning: self-comparison always evaluates to false [-Wtautological-compare]
if (arg2 != arg2)
^~
There is a lot of similar code in this file. Maybe there is a logic behind it, but I don't see what it might be.
On a side note, that file declares various 'float' variables and functions. Is that permitted nowadays in the kernel ?
,
Jan 10 2018
#1: That may make sense for floats, but I don't think it does for unsigned int, which is what gcc complains about (but that explains why gcc doesn't complain about the floats).
,
Jan 10 2018
The int check was removed in the commit I mentioned in comment 1.
,
Jan 10 2018
#3: Yes, I just noticed. Is that patch in the queue for chromeos-4.14 ?
,
Jan 10 2018
I'm not sure.
,
Jan 10 2018
Ok, let's leave this open then for tracking. I'll assign to myself to make sure it gets addressed.
,
Jan 11 2018
After I will finish the whole large AMD patchlist (last batch of commits going through CQ right now). I will go back and compare what we have with 4.15 and drm-next etc and see what else we should apply in our tree. There will be definitely more things to fix like b/71640610
,
Feb 13 2018
,
Feb 14 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/08da2becd344bd169b2af6a15ddf4acc5080d43f commit 08da2becd344bd169b2af6a15ddf4acc5080d43f Author: Harry Wentland <harry.wentland@amd.com> Date: Wed Feb 14 08:48:23 2018 UPSTREAM: drm/amd/display: Use macro for isnan check In code provided by HW teams we do a NaN check on floats by comparing the number against itself. This confuses most people including myself. Macro it out to make it self-explanatory. Don't do a NaN check for int. v2: parantheses around 'number' expression Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> BUG= chromium:800873 TEST=Build and boot Change-Id: I2e4c610b13a9c6e83f26db85a980a4b2647233ff Signed-off-by: Guenter Roeck <groeck@chromium.org> (cherry picked from commit 3f4e3a282e1235a9ab46d063b0902c00b6afc6a9) Reviewed-on: https://chromium-review.googlesource.com/917312 Reviewed-by: Dominik Behr <dbehr@chromium.org> [modify] https://crrev.com/08da2becd344bd169b2af6a15ddf4acc5080d43f/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c
,
Feb 14 2018
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by alexdeuc...@gmail.com
, Jan 10 2018