• Hans Verkuil's avatar
    media: videobuf2-v4l2.c: move up STATE_DEQUEUED check · 1f7f11e8
    Hans Verkuil authored
    If a buffer is queued to a request, followed by an attempt to queue
    the same buffer again, then the second qbuf returns an error since
    the buffer is not in the DEQUEUED state anymore.
    
    However, before it gets to that check it executes the code under the
    'if (!vb->prepared)' condition. This clears previously set data needed
    for request handling, and now querybuf will no longer report that this
    buffer is part of a request.
    
    Move the state check to before the 'if' and make sure to only do the
    state check when called from QBUF and if V4L2_BUF_FLAG_REQUEST_FD is
    set.
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
    1f7f11e8
videobuf2-v4l2.c 32.8 KB