[media] v4l2-ctrls: arrays are also considered compound controls
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 21 Sep 2015 09:14:16 +0000 (06:14 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 1 Oct 2015 11:30:25 +0000 (08:30 -0300)
Array controls weren't skipped when only V4L2_CTRL_FLAG_NEXT_CTRL was
provided (so no V4L2_CTRL_FLAG_NEXT_COMPOUND was set). This is wrong
since arrays are also considered compound controls (i.e. with more than
one value), and applications that do not know about arrays will not
be able to handle such controls.

Fix the test to include arrays.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: <stable@vger.kernel.org> # for v3.17 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/v4l2-ctrls.c

index b6b7dcc1b77d4523373097871664df7ac458c317..d5de70e629898878a54473814a55aae20aabb29b 100644 (file)
@@ -2498,7 +2498,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
                        /* We found a control with the given ID, so just get
                           the next valid one in the list. */
                        list_for_each_entry_continue(ref, &hdl->ctrl_refs, node) {
-                               is_compound =
+                               is_compound = ref->ctrl->is_array ||
                                        ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
                                if (id < ref->ctrl->id &&
                                    (is_compound & mask) == match)
@@ -2512,7 +2512,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
                           is one, otherwise the first 'if' above would have
                           been true. */
                        list_for_each_entry(ref, &hdl->ctrl_refs, node) {
-                               is_compound =
+                               is_compound = ref->ctrl->is_array ||
                                        ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
                                if (id < ref->ctrl->id &&
                                    (is_compound & mask) == match)