diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-12-29 12:27:05 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-30 05:02:18 -0500 |
commit | 02ac04805e6a753610d7dd1716181ccbd8e366af (patch) | |
tree | 84333bc8469a497aee775457837e1dc86509c550 /drivers/media/video/v4l2-ctrls.c | |
parent | 513521eaee4375a1a0da0b73c7131a165a9fe4d9 (diff) |
[media] v4l2-ctrls: only check def for menu, integer and boolean controls
The 'def' field is only valid for menus, integers and booleans.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ctrls.c')
-rw-r--r-- | drivers/media/video/v4l2-ctrls.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 6c0fadc2beab..8f81efcfcf56 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c | |||
@@ -962,13 +962,20 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, | |||
962 | 962 | ||
963 | /* Sanity checks */ | 963 | /* Sanity checks */ |
964 | if (id == 0 || name == NULL || id >= V4L2_CID_PRIVATE_BASE || | 964 | if (id == 0 || name == NULL || id >= V4L2_CID_PRIVATE_BASE || |
965 | def < min || def > max || max < min || | 965 | max < min || |
966 | (type == V4L2_CTRL_TYPE_INTEGER && step == 0) || | 966 | (type == V4L2_CTRL_TYPE_INTEGER && step == 0) || |
967 | (type == V4L2_CTRL_TYPE_MENU && qmenu == NULL) || | 967 | (type == V4L2_CTRL_TYPE_MENU && qmenu == NULL) || |
968 | (type == V4L2_CTRL_TYPE_STRING && max == 0)) { | 968 | (type == V4L2_CTRL_TYPE_STRING && max == 0)) { |
969 | handler_set_err(hdl, -ERANGE); | 969 | handler_set_err(hdl, -ERANGE); |
970 | return NULL; | 970 | return NULL; |
971 | } | 971 | } |
972 | if ((type == V4L2_CTRL_TYPE_INTEGER || | ||
973 | type == V4L2_CTRL_TYPE_MENU || | ||
974 | type == V4L2_CTRL_TYPE_BOOLEAN) && | ||
975 | (def < min || def > max)) { | ||
976 | handler_set_err(hdl, -ERANGE); | ||
977 | return NULL; | ||
978 | } | ||
972 | 979 | ||
973 | if (type == V4L2_CTRL_TYPE_BUTTON) | 980 | if (type == V4L2_CTRL_TYPE_BUTTON) |
974 | flags |= V4L2_CTRL_FLAG_WRITE_ONLY; | 981 | flags |= V4L2_CTRL_FLAG_WRITE_ONLY; |