usb: misc: remove unnecessary code
PATCH 1/1 usb: misc: remove unnecessary code
'val' is an unsigned variable, and less-than-zero comparison of an unsigned variable is never true.
Addresses-Coverity-ID: 1230257
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/lvstest.c +1 -1
@@ -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),
Signature · 1 line
2.5.0
Quoted 2 lines · Gustavo A. R. Silva
'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.
Quoted 2 lines
Addresses-Coverity-ID: 1230257
Reviewed-by Peter Senna Tschudin <[email protected]>
Quoted 21 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/misc/lvstest.c +1
-1@@ -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),Signature · 1 line
2.5.0
Hi Peter,
Quoting Peter Senna Tschudin <[email protected]>:
Quoted 23 lines · Gustavo A. R. Silva
Quoted 2 lines
'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.Quoted 2 lines
Addresses-Coverity-ID: 1230257
Reviewed-by Peter Senna Tschudin <[email protected]>Quoted 13 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/misc/lvstest.c +0
-0@@ -193,7 +193,7 @@ static ssize_t u2_timeout_store(struct device *dev,return ret; }
Quoted 8 lines
Quoted 8 lines
drivers/usb/misc/lvstest.c +1
-2-if (val <0 || val >127 ) +if (val >127 )return -EINVAL ; ret = lvs_rh_set_port_feature(hdev, lvs->portnum | (val << 8), --2.5.0
Thanks for your comments.
--
Gustavo A. R. Silva