diff mbox

[1/1] net: pegasus: simplify logical constraint

Message ID 1463596851-3581-1-git-send-email-xypron.glpk@gmx.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Heinrich Schuchardt May 18, 2016, 6:40 p.m. UTC
If !count is true, count < 4 is also true.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/net/usb/pegasus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petko Manolov May 19, 2016, 5:57 a.m. UTC | #1
On 16-05-18 20:40:51, Heinrich Schuchardt wrote:
> If !count is true, count < 4 is also true.

Yep, you're right.  However, gcc optimizes away the first condition.  What you 
really got me to think about is whether 4 is the right number.  I guess i shall 
refer to the HW documentation.


		Petko


> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/net/usb/pegasus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index 36cd7f0..9bbe0161 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
> @@ -473,7 +473,7 @@ static void read_bulk_callback(struct urb *urb)
>  		goto goon;
>  	}
>  
> -	if (!count || count < 4)
> +	if (count < 4)
>  		goto goon;
>  
>  	rx_status = buf[count - 2];
> -- 
> 2.1.4
> 
>
David Miller May 23, 2016, 8:49 p.m. UTC | #2
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Wed, 18 May 2016 20:40:51 +0200

> If !count is true, count < 4 is also true.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied.
diff mbox

Patch

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 36cd7f0..9bbe0161 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -473,7 +473,7 @@  static void read_bulk_callback(struct urb *urb)
 		goto goon;
 	}
 
-	if (!count || count < 4)
+	if (count < 4)
 		goto goon;
 
 	rx_status = buf[count - 2];