V4L/DVB (8526): saa7146: fix VIDIOC_ENUM_FMT

Previous thread: V4L/DVB (8525): fix a few assorted spelling mistakes. by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)

Next thread: V4L/DVB (8529): mxl5007t: enable _init and _sleep power management functionality by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:04 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f79680...
Commit:     f796804f01429b832e1e734c54f0f535b322c665
Parent:     de1e575db21a341b77b296af7dd87f163ebf6020
Author:     Hans Verkuil <hverkuil@xs4all.nl>
AuthorDate: Sat Jul 26 09:16:29 2008 -0300
Committer:  Mauro Carvalho Chehab <mchehab@infradead.org>
CommitDate: Sun Jul 27 11:07:14 2008 -0300

    V4L/DVB (8526): saa7146: fix VIDIOC_ENUM_FMT
    
    VIDIOC_ENUM_FMT should keep the index and type fields. Instead,
    type was zeroed.
    
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
 drivers/media/common/saa7146_video.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index a5e6275..acaddc1 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -958,21 +958,18 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
 	case VIDIOC_ENUM_FMT:
 	{
 		struct v4l2_fmtdesc *f = arg;
-		int index;
 
 		switch (f->type) {
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-		case V4L2_BUF_TYPE_VIDEO_OVERLAY: {
-			index = f->index;
-			if (index < 0 || index >= NUM_FORMATS) {
+		case V4L2_BUF_TYPE_VIDEO_OVERLAY:
+			if (f->index >= NUM_FORMATS)
 				return -EINVAL;
-			}
-			memset(f,0,sizeof(*f));
-			f->index = index;
-			strlcpy((char *)f->description,formats[index].name,sizeof(f->description));
-			f->pixelformat = formats[index].pixelformat;
+			strlcpy((char *)f->description, formats[f->index].name,
+					sizeof(f->description));
+			f->pixelformat = formats[f->index].pixelformat;
+			f->flags = 0;
+			memset(f->reserved, 0, sizeof(f->reserved));
 			break;
-		}
 		default:
 			return -EINVAL;
 		}
--

Previous thread: V4L/DVB (8525): fix a few assorted spelling mistakes. by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)

Next thread: V4L/DVB (8529): mxl5007t: enable _init and _sleep power management functionality by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)