* [patch] usb/uvc_v4l2: cleanup test for end of loop
@ 2010-08-12 7:59 Dan Carpenter
2010-08-12 8:02 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-08-12 7:59 UTC (permalink / raw)
To: kernel-janitors
We're trying to test for the the end of the loop here. "format" is
never NULL. We don't know what "format->fcc" is because we're past the
end of the loop and I think "fmt->fmt.pix.pixelformat" comes from the
user so we don't know what that is either. It works, but it's cleaner
to just test to see if (i = ARRAY_SIZE(uvc_formats).
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
index 2dcffda..5e807f0 100644
--- a/drivers/usb/gadget/uvc_v4l2.c
+++ b/drivers/usb/gadget/uvc_v4l2.c
@@ -94,7 +94,7 @@ uvc_v4l2_set_format(struct uvc_video *video, struct v4l2_format *fmt)
break;
}
- if (format = NULL || format->fcc != fmt->fmt.pix.pixelformat) {
+ if (i = ARRAY_SIZE(uvc_formats)) {
printk(KERN_INFO "Unsupported format 0x%08x.\n",
fmt->fmt.pix.pixelformat);
return -EINVAL;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] usb/uvc_v4l2: cleanup test for end of loop
2010-08-12 7:59 [patch] usb/uvc_v4l2: cleanup test for end of loop Dan Carpenter
@ 2010-08-12 8:02 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2010-08-12 8:02 UTC (permalink / raw)
To: kernel-janitors
Hi Dan,
Thanks for the patch.
On Thursday 12 August 2010 09:59:58 Dan Carpenter wrote:
> We're trying to test for the the end of the loop here. "format" is
> never NULL. We don't know what "format->fcc" is because we're past the
> end of the loop and I think "fmt->fmt.pix.pixelformat" comes from the
> user so we don't know what that is either. It works, but it's cleaner
> to just test to see if (i = ARRAY_SIZE(uvc_formats).
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
> index 2dcffda..5e807f0 100644
> --- a/drivers/usb/gadget/uvc_v4l2.c
> +++ b/drivers/usb/gadget/uvc_v4l2.c
> @@ -94,7 +94,7 @@ uvc_v4l2_set_format(struct uvc_video *video, struct
> v4l2_format *fmt) break;
> }
>
> - if (format = NULL || format->fcc != fmt->fmt.pix.pixelformat) {
> + if (i = ARRAY_SIZE(uvc_formats)) {
> printk(KERN_INFO "Unsupported format 0x%08x.\n",
> fmt->fmt.pix.pixelformat);
> return -EINVAL;
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-12 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-12 7:59 [patch] usb/uvc_v4l2: cleanup test for end of loop Dan Carpenter
2010-08-12 8:02 ` Laurent Pinchart
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.