kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Staging: xgifb: fix bitwise vs logical bug
@ 2012-08-14  7:04 Dan Carpenter
  2012-08-14 10:45 ` Peter Hüwe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-08-14  7:04 UTC (permalink / raw)
  To: kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 80dba6a..fdb7d1a 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -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);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] Staging: xgifb: fix bitwise vs logical bug
  2012-08-14  7:04 [patch] Staging: xgifb: fix bitwise vs logical bug Dan Carpenter
@ 2012-08-14 10:45 ` Peter Hüwe
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Hüwe @ 2012-08-14 10:45 UTC (permalink / raw)
  To: kernel-janitors

Am Dienstag, 14. August 2012, 09:04:45 schrieb Dan Carpenter:
> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
I guess this is correct.

Reviewed-by: Peter Huewe <peterhuewe@gmx.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-14 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14  7:04 [patch] Staging: xgifb: fix bitwise vs logical bug Dan Carpenter
2012-08-14 10:45 ` Peter Hüwe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).