From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] usb/uvc_v4l2: cleanup test for end of loop
Date: Thu, 12 Aug 2010 07:59:58 +0000 [thread overview]
Message-ID: <20100812075958.GP645@bicker> (raw)
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;
next reply other threads:[~2010-08-12 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 7:59 Dan Carpenter [this message]
2010-08-12 8:02 ` [patch] usb/uvc_v4l2: cleanup test for end of loop Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100812075958.GP645@bicker \
--to=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox