Commit fc0232e2 authored by Boris Brezillon's avatar Boris Brezillon Committed by Greg Kroah-Hartman

media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom()

commit 07d89227 upstream.

cfg->type can be overridden by v4l2_ctrl_fill() and the new value is
stored in the local type var. Fix the tests to use this local var.

Fixes: 0996517c ("V4L/DVB: v4l2: Add new control handling framework")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
[hverkuil-cisco@xs4all.nl: change to !qmenu and !qmenu_int (checkpatch)]
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a4c4c06f
...@@ -2249,16 +2249,15 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, ...@@ -2249,16 +2249,15 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
v4l2_ctrl_fill(cfg->id, &name, &type, &min, &max, &step, v4l2_ctrl_fill(cfg->id, &name, &type, &min, &max, &step,
&def, &flags); &def, &flags);
is_menu = (cfg->type == V4L2_CTRL_TYPE_MENU || is_menu = (type == V4L2_CTRL_TYPE_MENU ||
cfg->type == V4L2_CTRL_TYPE_INTEGER_MENU); type == V4L2_CTRL_TYPE_INTEGER_MENU);
if (is_menu) if (is_menu)
WARN_ON(step); WARN_ON(step);
else else
WARN_ON(cfg->menu_skip_mask); WARN_ON(cfg->menu_skip_mask);
if (cfg->type == V4L2_CTRL_TYPE_MENU && qmenu == NULL) if (type == V4L2_CTRL_TYPE_MENU && !qmenu) {
qmenu = v4l2_ctrl_get_menu(cfg->id); qmenu = v4l2_ctrl_get_menu(cfg->id);
else if (cfg->type == V4L2_CTRL_TYPE_INTEGER_MENU && } else if (type == V4L2_CTRL_TYPE_INTEGER_MENU && !qmenu_int) {
qmenu_int == NULL) {
handler_set_err(hdl, -EINVAL); handler_set_err(hdl, -EINVAL);
return NULL; return NULL;
} }
......
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