Commit 7bb846af authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (7946): videodev: small fixes for VIDIOC_G_FREQUENCY and VIDIOC_G_FMT

__video_do_ioctl incorrectly zeroed the tuner field of v4l2_frequency and
did not zero the full fmt union of v4l2_format.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 1d0ba5f3
...@@ -883,16 +883,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -883,16 +883,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
case VIDIOC_G_FMT: case VIDIOC_G_FMT:
{ {
struct v4l2_format *f = (struct v4l2_format *)arg; struct v4l2_format *f = (struct v4l2_format *)arg;
enum v4l2_buf_type type=f->type;
memset(&f->fmt.pix,0,sizeof(f->fmt.pix)); memset(f->fmt.raw_data, 0, sizeof(f->fmt.raw_data));
f->type=type;
/* FIXME: Should be one dump per type */ /* FIXME: Should be one dump per type */
dbgarg (cmd, "type=%s\n", prt_names(type, dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
v4l2_type_names));
switch (type) { switch (f->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (vfd->vidioc_g_fmt_cap) if (vfd->vidioc_g_fmt_cap)
ret=vfd->vidioc_g_fmt_cap(file, fh, f); ret=vfd->vidioc_g_fmt_cap(file, fh, f);
...@@ -1688,16 +1685,17 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1688,16 +1685,17 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
} }
case VIDIOC_G_FREQUENCY: case VIDIOC_G_FREQUENCY:
{ {
struct v4l2_frequency *p=arg; struct v4l2_frequency *p = arg;
if (!vfd->vidioc_g_frequency) if (!vfd->vidioc_g_frequency)
break; break;
memset(p,0,sizeof(*p)); memset(p->reserved, 0, sizeof(p->reserved));
ret=vfd->vidioc_g_frequency(file, fh, p); ret = vfd->vidioc_g_frequency(file, fh, p);
if (!ret) if (!ret)
dbgarg (cmd, "tuner=%d, type=%d, frequency=%d\n", dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
p->tuner,p->type,p->frequency); p->tuner, p->type, p->frequency);
break; break;
} }
case VIDIOC_S_FREQUENCY: case VIDIOC_S_FREQUENCY:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment