EDAC/skx_base: Fix ambiguous bitwise and logical operator style
Subsystems (2)
PATCH 1/1 EDAC/skx_base: Fix ambiguous bitwise and logical operator style
The code works fine and works how it should be, the fix is just for uniformity/consistency of the bitwise operations. Also fix the compiler warning.
lchan here is always 0 or 1 here, replace the inconsistance logical operator by xor operation resulting 1 or 2. This remove the compiler warning and make the switch case easier for reading.
--- drivers/edac/skx_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/skx_base.c +1 -1
@@ -356,7 +356,7 @@ static bool skx_sad_decode(struct decoded_addr *res)break ;case 2 : lchan = (addr >> shift) %2 ; - lchan = (lchan <<1 ) | !lchan; + lchan = (lchan <<1 ) | (lchan ^1 );break ;case 3 : lchan = ((addr >> shift) %2 ) <<1 ;
Signature · 1 line
2.55.0
Luck, Tony
maintainerQuoted 3 lines
The code works fine and works how it should be, the fix is just for uniformity/consistency of the bitwise operations. Also fix the compiler warning.
Details? I don't see a warning with gcc 14.3.1
Which compiler, version, and any relevant compiler flags.
What is the warning message?
-Tony
On 2026-09-23 00:20 +0000, Luck, Tony wrote:
Hi Tony,
Quoted 4 lines
Quoted 3 lines
The code works fine and works how it should be, the fix is just for uniformity/consistency of the bitwise operations. Also fix the compiler warning.
Quoted 8 lines
Details? I don't see a warning with gcc 14.3.1
Which compiler, version, and any relevant compiler flags.
What is the warning message?
-Tony
Sorry for my mistake, this is not compiler warning, but warning from the sparse, here is the warning message:drivers/edac/skx_base.c:359:46: warning: dubious: x | !y
The command and flag used:
make C=1 W=1 drivers/edac/skx_base.o
The change is a style fix rather than gcc warning fix. After change, the whole operation will be bitwise shift and xor, instead of bitwise shift and logical (not), which increase readability and consistancy.
My gcc version is 16.2.1 20260810
Quoted 3 lines
Sorry for my mistake, this is not compiler warning, but warning from the sparse, here is the warning message:
drivers/edac/skx_base.c:359:46: warning: dubious: x | !y
Ok. I updated the commit message to say "sparse warning" and pasted in that message.
Applied, thanks.
-Tony
Quoted 10 lines · Tony
Quoted 3 lines
Sorry for my mistake, this is not compiler warning, but warning from the sparse, here is the warning message:
drivers/edac/skx_base.c:359:46: warning: dubious: x | !yOk. I updated the commit message to say "sparse warning" and pasted in that message.
Applied, thanks.
-Tony
Thank you Tony, I will be more careful writing discriptions in the future.
-Bryan