]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (8526): saa7146: fix VIDIOC_ENUM_FMT
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 26 Jul 2008 12:16:29 +0000 (09:16 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 27 Jul 2008 14:07:14 +0000 (11:07 -0300)
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

index a5e62750eea3cb59b976aec917e6b88ab2a1ed87..acaddc15dadc8a7722774437fbb9dfa7bc0ae261 100644 (file)
@@ -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;
                }