Skip to contentSkip to conversation

Staging: xgifb: fix bitwise vs logical bug

PATCH In review Dan Carpenter 2 participants 2 messages Aug 14, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: xgifb: fix bitwise vs logical bug

This is a static checker fix and not something I can test. The intent of the code here is to set some bit flags. For a logical OR the ">> 1" shift wouldn't make a difference. So it should be using a bitwise OR.

drivers/staging/xgifb/vb_init.c +1 -1
index 80dba6a..fdb7d1a 100644
@@ -1269,7 +1269,7 @@ static unsigned char GetXG27FPBits(struct vb_device_info *pVBInfo)
 	if (temp <= 2)
 		temp &= 0x03;
 	else
-		temp = ((temp & 0x04) >> 1) || ((~temp) & 0x01);
+		temp = ((temp & 0x04) >> 1) | ((~temp) & 0x01);
 
 	xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
 
Reviewed-by on v1 1/1
#1 lore raw

Am Dienstag, 14. August 2012, 09:04:45 schrieb Dan Carpenter:

Quoted 5 lines

This is a static checker fix and not something I can test. The intent of the code here is to set some bit flags. For a logical OR the ">> 1" shift wouldn't make a difference. So it should be using a bitwise OR.

I guess this is correct.