media: v4l2-subdev.c: clear stream field
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 15 Feb 2023 14:48:17 +0000 (15:48 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 26 Feb 2023 10:21:33 +0000 (11:21 +0100)
commit68e87ebf2605643072264ed452f4e560417ddb1b
treea7059fa2728ded4966b8272717caf9216e0c5c4d
parent83e0f265aa8d0e37cc8e15d318b64da0ec03ff41
media: v4l2-subdev.c: clear stream field

Both userspace and kernelspace can pass structs with an uninitialized
'stream' field. Since the check_state() function checks for a non-zero
stream field, suddenly these calls will fails with -EINVAL.

So check in the wrapper functions in v4l2-subdev.c (which are used by both
the kernel and userspace API) if V4L2_SUBDEV_FL_STREAMS is set, and if not,
then zero the stream field.

Currently no drivers set V4L2_SUBDEV_FL_STREAMS, so the stream field will
always be set to 0.

This patch might well be reverted in the future when streams support is
fully enabled and we finalized the userspace API support for this feature.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-subdev.c