if (index < 0 || index >= gbuffers)
return -EINVAL;
- memset(buf, 0, sizeof(*buf));
-
- buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- buf->index = index;
buf->bytesused = meye.grab_buffer[index].size;
buf->flags = V4L2_BUF_FLAG_MAPPED;
static int stk_vidioc_querybuf(struct file *filp,
void *priv, struct v4l2_buffer *buf)
{
- int index;
struct stk_camera *dev = priv;
struct stk_sio_buffer *sbuf;
- if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
-
- index = buf->index;
-
- if (index < 0 || index >= dev->n_sbufs)
+ if (buf->index < 0 || buf->index >= dev->n_sbufs)
return -EINVAL;
sbuf = dev->sio_bufs + buf->index;
*buf = sbuf->v4lbuf;
/* FIXME : must control
that buffers are mapped (VIDIOC_REQBUFS has been called) */
- if(vb->type != V4L2_CAP_VIDEO_CAPTURE) {
- return -EINVAL;
- }
if(vb->index>=usbvision->num_frames) {
return -EINVAL;
}
if (ret)
break;
+ /* Zero out all fields starting with bytesysed, which is
+ * everything but index and type. */
+ memset(0, &p->bytesused,
+ sizeof(*p) - offsetof(typeof(*p), bytesused));
+
ret = ops->vidioc_querybuf(file, fh, p);
if (!ret)
dbgbuf(cmd, vfd, p);
{
struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr;
- __u32 type = buf->type;
- int index = buf->index, res;
-
- memset(buf, 0, sizeof(*buf));
- buf->type = type;
- buf->index = index;
+ int res;
mutex_lock(&zr->resource_lock);
res = zoran_v4l2_buffer_status(file, buf, buf->index);