Skip to contentSkip to conversation

staging: rts5208: remove always true comparison

PATCH In review Sudip Mukherjee 2 participants 5 messages May 14, 2015 – May 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rts5208: remove always true comparison

the if comparison is always true as anything bitwise and-ing with 0x1E can never be equal to 0x03.

Fixes bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69881

---
 drivers/staging/rts5208/sd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rts5208/sd.c +2 -4
index a8d657b..2e3f1f4 100644
@@ -4170,10 +4170,8 @@ RTY_SEND_CMD:
 				}
 
 			} else if (rsp_type == SD_RSP_TYPE_R0) {
-				if ((ptr[3] & 0x1E) != 0x03) {
-					rtsx_trace(chip);
-					return STATUS_FAIL;
-				}
+				rtsx_trace(chip);
+				return STATUS_FAIL;
 			}
 		}
 	}
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 5 lines · Sudip Mukherjee

the if comparison is always true as anything bitwise and-ing with 0x1E can never be equal to 0x03.

Fixes bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69881

It doesn't fix anything though, it just silences the warning. Warnings are nice because they let you know that the code is buggy. It's better to leave them there instead of making the bugs more complicated to find.

Micky Ching might know if this is the right thing to do or if something else was intended instead of 0x03?

regards,
dan carpenter

Quoted 30 lines
---
 drivers/staging/rts5208/sd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rts5208/sd.c +2 -4
index a8d657b..2e3f1f4 100644
@@ -4170,10 +4170,8 @@ RTY_SEND_CMD:
 				}
 
 			} else if (rsp_type == SD_RSP_TYPE_R0) {
-				if ((ptr[3] & 0x1E) != 0x03) {
-					rtsx_trace(chip);
-					return STATUS_FAIL;
-				}
+				rtsx_trace(chip);
+				return STATUS_FAIL;
 			}
 		}
 	}
Signature · 6 lines
1.8.1.2

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#2 lore raw
Quoted 10 lines · Dan Carpenter
Quoted 5 lines · Sudip Mukherjee

the if comparison is always true as anything bitwise and-ing with 0x1E can never be equal to 0x03.

Fixes bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69881

It doesn't fix anything though, it just silences the warning. Warnings are nice because they let you know that the code is buggy. It's better to leave them there instead of making the bugs more complicated to find.

but I am not seeing any warnings. I tried with make W=1, tried with sparse, but still no warning. am i missing something?

regards
sudip

#3 lore raw
Quoted 8 lines · Sudip Mukherjee
Quoted 7 lines · Dan Carpenter
Quoted 5 lines · Sudip Mukherjee

the if comparison is always true as anything bitwise and-ing with 0x1E can never be equal to 0x03.

Fixes bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69881

Quoted 6 lines
Quoted 3 lines

It doesn't fix anything though, it just silences the warning. Warnings are nice because they let you know that the code is buggy. It's better to leave them there instead of making the bugs more complicated to find.

but I am not seeing any warnings. I tried with make W=1, tried with sparse, but still no warning. am i missing something?

David Binderman is using a static checker of some kind. I'm not sure which. It might be cppcheck or it might be something private.

regards,
dan carpenter

#4 lore raw
Quoted 13 lines · Dan Carpenter
Quoted 12 lines · Sudip Mukherjee
Quoted 10 lines · Dan Carpenter
Quoted 5 lines · Sudip Mukherjee

the if comparison is always true as anything bitwise and-ing with 0x1E can never be equal to 0x03.

Fixes bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69881

It doesn't fix anything though, it just silences the warning. Warnings are nice because they let you know that the code is buggy. It's better to leave them there instead of making the bugs more complicated to find.

Quoted 5 lines
Quoted 2 lines

but I am not seeing any warnings. I tried with make W=1, tried with sparse, but still no warning. am i missing something?

David Binderman is using a static checker of some kind. I'm not sure which. It might be cppcheck or it might be something private.

Its not cppcheck. I use it when I feel lazy. :) And if it is something private then only David can see the warning, in that case why do we need to keep a code which is obviously wrong?

regards
sudip