All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rts5208: fix always true condition
@ 2014-02-15  9:44 Levente Kurusa
  2014-02-15 10:41 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Levente Kurusa @ 2014-02-15  9:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Micky Ching
  Cc: LKML, OSUOSL Drivers, David Binderman, Levente Kurusa

ANDing anything with 0x1E and expecting it to be not 0x03 will always
be true. AND instead with 0x03, so that we check the last two bits,
which should be what was intended there.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Levente Kurusa <levex@linux.com>
---
 drivers/staging/rts5208/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index c7c1f54..03548e5 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -3512,7 +3512,7 @@ RTY_SEND_CMD:
 					TRACE_RET(chip, STATUS_FAIL);
 
 			} else if (rsp_type == SD_RSP_TYPE_R0) {
-				if ((ptr[3] & 0x1E) != 0x03)
+				if ((ptr[3] & 0x03) != 0x03)
 					TRACE_RET(chip, STATUS_FAIL);
 			}
 		}
-- 
1.8.3.1


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

* Re: [PATCH] staging: rts5208: fix always true condition
  2014-02-15  9:44 [PATCH] staging: rts5208: fix always true condition Levente Kurusa
@ 2014-02-15 10:41 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-02-15 10:41 UTC (permalink / raw)
  To: Levente Kurusa
  Cc: Greg Kroah-Hartman, Micky Ching, OSUOSL Drivers, LKML, David Binderman

On Sat, Feb 15, 2014 at 10:44:35AM +0100, Levente Kurusa wrote:
> ANDing anything with 0x1E and expecting it to be not 0x03 will always
> be true. AND instead with 0x03, so that we check the last two bits,
> which should be what was intended there.
> 

This one is less clear what the intent was.  Could easily be that the
0x3 is wrong.

Sometimes it's better to leave the warning rather than guess at the fix.

regards,
dan carpenter


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

end of thread, other threads:[~2014-02-15 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15  9:44 [PATCH] staging: rts5208: fix always true condition Levente Kurusa
2014-02-15 10:41 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.