Skip to contentSkip to conversation

EDAC, skx_edac: Fix logical channel intermediate decoding bug

PATCH Luck, Tony 1 participant 1 message Oct 9, 2018

Subsystems (2)
lore
Share & tools
lore

Luck, Tony

author maintainer
#0 lore raw

From: Qiuxu Zhuo <[email protected]>

The code "lchan = (lchan << 1) | ~lchan" for logical channel intermediate decoding is wrong. The wrong intermediate decoding result is {0xffffffff, 0xfffffffe}.

Fix it by replacing '~' with '!'. The correct intermediate decoding result is {0x1, 0x2}.

---
 drivers/edac/skx_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/skx_edac.c +1 -1
index fae095162c01..45c5a8931a58 100644
@@ -668,7 +668,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;
 			break;
 		case 3:
 			lchan = ((addr >> shift) % 2) << 1;