• Hans Verkuil's avatar
    media: v4l2-subdev.c: clear stream field · 68e87ebf
    Hans Verkuil authored
    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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    68e87ebf
v4l2-subdev.c 52.2 KB