Skip to content

Commit

Permalink
[media] vb2: fix wrong owner check
Browse files Browse the repository at this point in the history
Check against q->fileio to see if the queue owner should be set or not.
The former check against the return value of read or write is wrong, since
read/write can return an error, even if the queue is in streaming mode.
For example, EAGAIN when in non-blocking mode.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Sep 26, 2012
1 parent d2210f9 commit 8c82c75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/v4l2-core/videobuf2-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ ssize_t vb2_fop_write(struct file *file, char __user *buf,
goto exit;
err = vb2_write(vdev->queue, buf, count, ppos,
file->f_flags & O_NONBLOCK);
if (err >= 0)
if (vdev->queue->fileio)
vdev->queue->owner = file->private_data;
exit:
if (lock)
Expand All @@ -2300,7 +2300,7 @@ ssize_t vb2_fop_read(struct file *file, char __user *buf,
goto exit;
err = vb2_read(vdev->queue, buf, count, ppos,
file->f_flags & O_NONBLOCK);
if (err >= 0)
if (vdev->queue->fileio)
vdev->queue->owner = file->private_data;
exit:
if (lock)
Expand Down

0 comments on commit 8c82c75

Please sign in to comment.