* [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style
@ 2026-09-22 23:18 Bryan Chan
2026-09-23 0:20 ` Luck, Tony
0 siblings, 1 reply; 5+ messages in thread
From: Bryan Chan @ 2026-09-22 23:18 UTC (permalink / raw)
To: Tony Luck, Borislav Petkov, open list:EDAC-SKYLAKE, open list
Cc: linux-edac, linux-kernel, Bryan Chan
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.
Signed-off-by: Bryan Chan <bchimhim15@gmail.com>
---
drivers/edac/skx_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/edac/skx_base.c b/drivers/edac/skx_base.c
index de749413ff9a..ae2fda006632 100644
--- a/drivers/edac/skx_base.c
+++ b/drivers/edac/skx_base.c
@@ -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;
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style
2026-09-22 23:18 [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style Bryan Chan
@ 2026-09-23 0:20 ` Luck, Tony
2026-09-23 3:47 ` Bryan Chan
0 siblings, 1 reply; 5+ messages in thread
From: Luck, Tony @ 2026-09-23 0:20 UTC (permalink / raw)
To: Bryan Chan, Borislav Petkov, open list:EDAC-SKYLAKE, open list
Cc: linux-edac, linux-kernel
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style
2026-09-23 0:20 ` Luck, Tony
@ 2026-09-23 3:47 ` Bryan Chan
2026-09-23 16:35 ` Luck, Tony
0 siblings, 1 reply; 5+ messages in thread
From: Bryan Chan @ 2026-09-23 3:47 UTC (permalink / raw)
To: Luck, Tony; +Cc: Bryan Chan, Borislav Petkov, open list:EDAC-SKYLAKE, open list
On 2026-09-23 00:20 +0000, Luck, Tony wrote:
Hi Tony,
> > 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
>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style
2026-09-23 3:47 ` Bryan Chan
@ 2026-09-23 16:35 ` Luck, Tony
2026-09-23 16:56 ` Bryan Chan
0 siblings, 1 reply; 5+ messages in thread
From: Luck, Tony @ 2026-09-23 16:35 UTC (permalink / raw)
To: Bryan Chan; +Cc: Borislav Petkov, open list:EDAC-SKYLAKE, open list
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style
2026-09-23 16:35 ` Luck, Tony
@ 2026-09-23 16:56 ` Bryan Chan
0 siblings, 0 replies; 5+ messages in thread
From: Bryan Chan @ 2026-09-23 16:56 UTC (permalink / raw)
To: Luck, Tony; +Cc: Bryan Chan, Borislav Petkov, open list:EDAC-SKYLAKE, open list
On 2026-09-23 16:35 +0000, Luck, Tony wrote:
> > 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
Thank you Tony, I will be more careful writing discriptions in the future.
-Bryan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-23 16:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 23:18 [PATCH] EDAC/skx_base: Fix ambiguous bitwise and logical operator style Bryan Chan
2026-09-23 0:20 ` Luck, Tony
2026-09-23 3:47 ` Bryan Chan
2026-09-23 16:35 ` Luck, Tony
2026-09-23 16:56 ` Bryan Chan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®