* [PATCH] uvc: simplify redundant check
@ 2014-01-23 10:28 oliver
2014-01-23 10:28 ` oliver
2014-01-23 11:32 ` Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: oliver @ 2014-01-23 10:28 UTC (permalink / raw)
To: laurent.pinchart, linux-media; +Cc: Oliver Neukum
From: Oliver Neukum <oneukum@suse.de>
x < constant implies x + unsigned < constant
That check just obfuscates the code
Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
drivers/media/usb/uvc/uvc_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index c3bb250..b6cac17 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
case UVC_VC_HEADER:
n = buflen >= 12 ? buffer[11] : 0;
- if (buflen < 12 || buflen < 12 + n) {
+ if (buflen < 12 + n) {
uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
"interface %d HEADER error\n", udev->devnum,
alts->desc.bInterfaceNumber);
--
1.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] uvc: simplify redundant check
2014-01-23 10:28 [PATCH] uvc: simplify redundant check oliver
@ 2014-01-23 10:28 ` oliver
2014-01-23 11:32 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: oliver @ 2014-01-23 10:28 UTC (permalink / raw)
To: laurent.pinchart, linux-media; +Cc: Oliver Neukum
From: Oliver Neukum <oneukum@suse.de>
x < constant implies x + unsigned < constant
That check just obfuscates the code
Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
drivers/media/usb/uvc/uvc_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index c3bb250..b6cac17 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
case UVC_VC_HEADER:
n = buflen >= 12 ? buffer[11] : 0;
- if (buflen < 12 || buflen < 12 + n) {
+ if (buflen < 12 + n) {
uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
"interface %d HEADER error\n", udev->devnum,
alts->desc.bInterfaceNumber);
--
1.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] uvc: simplify redundant check
2014-01-23 10:28 [PATCH] uvc: simplify redundant check oliver
2014-01-23 10:28 ` oliver
@ 2014-01-23 11:32 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2014-01-23 11:32 UTC (permalink / raw)
To: oliver; +Cc: linux-media, Oliver Neukum
Hi Oliver,
Thank you for the patch.
On Thursday 23 January 2014 11:28:24 oliver@neukum.org wrote:
> From: Oliver Neukum <oneukum@suse.de>
>
> x < constant implies x + unsigned < constant
> That check just obfuscates the code
>
> Signed-off-by: Oliver Neukum <oneukum@suse.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
I've applied the patch to my tree and will send a pull request for v3.15.
> ---
> drivers/media/usb/uvc/uvc_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c
> b/drivers/media/usb/uvc/uvc_driver.c index c3bb250..b6cac17 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device
> *dev, case UVC_VC_HEADER:
> n = buflen >= 12 ? buffer[11] : 0;
>
> - if (buflen < 12 || buflen < 12 + n) {
> + if (buflen < 12 + n) {
> uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
> "interface %d HEADER error\n", udev->devnum,
> alts->desc.bInterfaceNumber);
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-23 11:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 10:28 [PATCH] uvc: simplify redundant check oliver
2014-01-23 10:28 ` oliver
2014-01-23 11:32 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox