On Tue, Mar 11, 2014 at 6:20 AM, Hans Verkuil <hverkuil@xxxxxxxxx> wrote: > From: Hans Verkuil <hans.verkuil@xxxxxxxxx> > > This is not allowed by the spec and does in fact not make any sense. > Return -EINVAL if this is the case. > > Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> > --- > drivers/media/v4l2-core/videobuf2-core.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c > index afd1268..8984187 100644 > --- a/drivers/media/v4l2-core/videobuf2-core.c > +++ b/drivers/media/v4l2-core/videobuf2-core.c > @@ -1526,6 +1526,15 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) > __func__, ret); > return ret; > } > + if (V4L2_TYPE_IS_OUTPUT(q->type) && b->field == V4L2_FIELD_ALTERNATE) { Checking for field first would probably eliminate the additional OUTPUT check most of the time. I'd swap them. > + /* > + * If field is ALTERNATE, then we return an error. I'd drop this line, doesn't really add anything. > + * If the format's field is ALTERNATE, then the buffer's field > + * should be either TOP or BOTTOM, but using ALTERNATE here as > + * well makes no sense. This doesn't really explain why this is an error and is confusing, since we don't check TOP/BOTTOM anyway. I think it would be better to say why ALTERNATE doesn't make sense instead. > + */ > + return -EINVAL; > + } > > vb->state = VB2_BUF_STATE_PREPARING; > vb->v4l2_buf.timestamp.tv_sec = 0; > -- > 1.9.0 > -- Best regards, Pawel Osciak -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html