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>
This commit is contained in:
Hans Verkuil 2008-07-26 09:16:29 -03:00 committed by Mauro Carvalho Chehab
parent de1e575db2
commit f796804f01

View file

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