aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-03-28 21:25:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:44 -0400
commit34796bc009565ea72643087b7d69c9fa748bce9b (patch)
tree85aa4eaaaad8f188cc574e9f8488f5fb2a5d51e3 /drivers/media
parent3fd8ab30c1fe9118a13f4b55172067ee04ef7a67 (diff)
V4L/DVB (11260): v4l2-ioctl: Check format for S_PARM and G_PARM
Return EINVAL if VIDIOC_S/G_PARM is called for a buffer type that the driver doesn't define a ->vidioc_try_fmt_XXX() method for. Several other ioctls, like QUERYBUF, QBUF, and DQBUF, etc. do this too. It saves each driver from having to check if the buffer type is one that it supports. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/v4l2-ioctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 54ba6b0b951f..f41c6f506f42 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1551,6 +1551,9 @@ static long __video_do_ioctl(struct file *file,
1551 struct v4l2_streamparm *p = arg; 1551 struct v4l2_streamparm *p = arg;
1552 1552
1553 if (ops->vidioc_g_parm) { 1553 if (ops->vidioc_g_parm) {
1554 ret = check_fmt(ops, p->type);
1555 if (ret)
1556 break;
1554 ret = ops->vidioc_g_parm(file, fh, p); 1557 ret = ops->vidioc_g_parm(file, fh, p);
1555 } else { 1558 } else {
1556 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1559 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -1570,6 +1573,10 @@ static long __video_do_ioctl(struct file *file,
1570 1573
1571 if (!ops->vidioc_s_parm) 1574 if (!ops->vidioc_s_parm)
1572 break; 1575 break;
1576 ret = check_fmt(ops, p->type);
1577 if (ret)
1578 break;
1579
1573 dbgarg(cmd, "type=%d\n", p->type); 1580 dbgarg(cmd, "type=%d\n", p->type);
1574 ret = ops->vidioc_s_parm(file, fh, p); 1581 ret = ops->vidioc_s_parm(file, fh, p);
1575 break; 1582 break;