All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: misc: remove unnecessary code
@ 2017-02-20 23:28 Gustavo A. R. Silva
  2017-02-21 22:11 ` Peter Senna Tschudin
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-02-20 23:28 UTC (permalink / raw)
  To: gregkh, wsa-dev, tj, bhaktipriya96
  Cc: linux-usb, linux-kernel, Peter Senna Tschudin,
	Gustavo A. R. Silva

'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 <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

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] usb: misc: remove unnecessary code
@ 2017-02-16 21:25 Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-02-16 21:25 UTC (permalink / raw)
  To: gregkh, wsa-dev, bhaktipriya96, tj
  Cc: linux-usb, linux-kernel, Peter Senna Tschudin,
	Gustavo A. R. Silva

'val' is an unsigned variable, and less-than-zero comparison of an unsigned
variable is never true.

Addresses-Coverity-ID: 1230256
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 7717651..c7c2104 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -222,7 +222,7 @@ static ssize_t u1_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

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

end of thread, other threads:[~2017-02-22  5:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-20 23:28 [PATCH] usb: misc: remove unnecessary code Gustavo A. R. Silva
2017-02-21 22:11 ` Peter Senna Tschudin
2017-02-22  5:35   ` Gustavo A. R. Silva
  -- strict thread matches above, loose matches on Subject: below --
2017-02-16 21:25 Gustavo A. R. Silva

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.