Skip to contentSkip to conversation

staging: rts5208: fix always true condition

PATCH In review Levente Kurusa 2 participants 2 messages Feb 15, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rts5208: fix always true condition

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.

---
 drivers/staging/rts5208/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts5208/sd.c +1 -1
index c7c1f54..03548e5 100644
@@ -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);
 			}
 		}
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 4 lines · 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.

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