media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 3 Nov 2021 12:28:31 +0000 (12:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 09:53:42 +0000 (10:53 +0100)
commit7cac8a56242779d8438f10723601e721c46cf41e
tree4baa66ce44e60a9c920654b4fa530269e5c46103
parent1da0b1cd4212acaeeed70a39a5a622a015bbab74
media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE

commit cd9d9377ed235b294a492a094e1666178a5e78fd upstream.

If V4L2_CAP_READWRITE is not set, then readbuffers must be set to 0,
otherwise v4l2-compliance will complain.

A note on the Fixes tag below: this patch does not really fix that commit,
but it can be applied from that commit onwards. For older code there is no
guarantee that device_caps is set, so even though this patch would apply,
it will not work reliably.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 049e684f2de9 (media: v4l2-dev: fix WARN_ON(!vdev->device_caps))
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-ioctl.c