Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1585775

Re: [PATCH] usb: misc: remove unnecessary code

From Peter Senna Tschudin <peter.senna@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: misc: remove unnecessary code
Date 2017-02-21 23:20 +0100
Message-ID <tdqWS-l3-19@gated-at.bofh.it> (permalink)
References <td626-2RA-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Feb 20, 2017 at 05:28:46PM -0600, Gustavo A. R. Silva wrote:
> 'val' is an unsigned variable, and less-than-zero comparison of an unsigned
> variable is never true.

I would add that val is set by kstrtoul() that converts a string to an
unsigned long.

> 
> Addresses-Coverity-ID: 1230257
Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/usb/misc/lvstest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
> index c7c2104..6f37610 100644
> --- a/drivers/usb/misc/lvstest.c
> +++ b/drivers/usb/misc/lvstest.c
> @@ -193,7 +193,7 @@ static ssize_t u2_timeout_store(struct device *dev,
>  		return ret;
>  	}
>  
> -	if (val < 0 || val > 127)
> +	if (val > 127)
>  		return -EINVAL;
>  
>  	ret = lvs_rh_set_port_feature(hdev, lvs->portnum | (val << 8),
> -- 
> 2.5.0
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] usb: misc: remove unnecessary code "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-21 01:00 +0100
  Re: [PATCH] usb: misc: remove unnecessary code Peter Senna Tschudin <peter.senna@gmail.com> - 2017-02-21 23:20 +0100
    Re: [PATCH] usb: misc: remove unnecessary code "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-22 06:40 +0100

csiph-web