All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rts5208: remove always true comparison
@ 2015-05-14 14:25 Sudip Mukherjee
  2015-05-14 15:18 ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2015-05-14 14:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel, linux-kernel, 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

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/rts5208/sd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index a8d657b..2e3f1f4 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -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;
 			}
 		}
 	}
-- 
1.8.1.2


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

* Re: [PATCH] staging: rts5208: remove always true comparison
  2015-05-14 14:25 [PATCH] staging: rts5208: remove always true comparison Sudip Mukherjee
@ 2015-05-14 15:18 ` Dan Carpenter
  2015-05-15 10:16   ` Sudip Mukherjee
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2015-05-14 15:18 UTC (permalink / raw)
  To: Sudip Mukherjee, Micky Ching; +Cc: Greg Kroah-Hartman, devel, linux-kernel

On Thu, May 14, 2015 at 07:55:59PM +0530, Sudip Mukherjee wrote:
> 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

> Reported-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/staging/rts5208/sd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
> index a8d657b..2e3f1f4 100644
> --- a/drivers/staging/rts5208/sd.c
> +++ b/drivers/staging/rts5208/sd.c
> @@ -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;
>  			}
>  		}
>  	}
> -- 
> 1.8.1.2
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: rts5208: remove always true comparison
  2015-05-14 15:18 ` Dan Carpenter
@ 2015-05-15 10:16   ` Sudip Mukherjee
  2015-05-25 16:22     ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2015-05-15 10:16 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Micky Ching, Greg Kroah-Hartman, devel, linux-kernel

On Thu, May 14, 2015 at 06:18:59PM +0300, Dan Carpenter wrote:
> On Thu, May 14, 2015 at 07:55:59PM +0530, Sudip Mukherjee wrote:
> > 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


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

* Re: [PATCH] staging: rts5208: remove always true comparison
  2015-05-15 10:16   ` Sudip Mukherjee
@ 2015-05-25 16:22     ` Dan Carpenter
  2015-05-26  4:55       ` Sudip Mukherjee
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2015-05-25 16:22 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Micky Ching, Greg Kroah-Hartman, devel, linux-kernel

On Fri, May 15, 2015 at 03:46:49PM +0530, Sudip Mukherjee wrote:
> On Thu, May 14, 2015 at 06:18:59PM +0300, Dan Carpenter wrote:
> > On Thu, May 14, 2015 at 07:55:59PM +0530, Sudip Mukherjee wrote:
> > > 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?

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


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

* Re: [PATCH] staging: rts5208: remove always true comparison
  2015-05-25 16:22     ` Dan Carpenter
@ 2015-05-26  4:55       ` Sudip Mukherjee
  0 siblings, 0 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-05-26  4:55 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Micky Ching, Greg Kroah-Hartman, devel, linux-kernel

On Mon, May 25, 2015 at 07:22:40PM +0300, Dan Carpenter wrote:
> On Fri, May 15, 2015 at 03:46:49PM +0530, Sudip Mukherjee wrote:
> > On Thu, May 14, 2015 at 06:18:59PM +0300, Dan Carpenter wrote:
> > > On Thu, May 14, 2015 at 07:55:59PM +0530, Sudip Mukherjee wrote:
> > > > 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?
> 
> 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

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

end of thread, other threads:[~2015-05-26  4:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 14:25 [PATCH] staging: rts5208: remove always true comparison Sudip Mukherjee
2015-05-14 15:18 ` Dan Carpenter
2015-05-15 10:16   ` Sudip Mukherjee
2015-05-25 16:22     ` Dan Carpenter
2015-05-26  4:55       ` Sudip Mukherjee

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.