summaryrefslogtreecommitdiff
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2013-02-07 07:05:43 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-08 17:30:53 -0200
commit82f0efbcd3c4e6bf7cdfeed5c901b812e6d30f92 (patch)
treef34422ddad3328fd8dc8f8c1827841c4e5817623 /drivers/media/usb
parentbf5bbed15c41228ea1abbb8d3931050922bfc37f (diff)
downloadlinux-82f0efbcd3c4e6bf7cdfeed5c901b812e6d30f92.tar.gz
[media] tm6000: fix an uninitialized variable
tm6000_poll could use an uninitialized buf pointer. Move the buf-handling code inside the 'if' that initializes the buf pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/tm6000/tm6000-video.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index eab23413a909..1a6857929c15 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -1455,14 +1455,14 @@ __tm6000_poll(struct file *file, struct poll_table_struct *wait)
if (list_empty(&fh->vb_vidq.stream))
return res | POLLERR;
buf = list_entry(fh->vb_vidq.stream.next, struct tm6000_buffer, vb.stream);
+ poll_wait(file, &buf->vb.done, wait);
+ if (buf->vb.state == VIDEOBUF_DONE ||
+ buf->vb.state == VIDEOBUF_ERROR)
+ return res | POLLIN | POLLRDNORM;
} else if (req_events & (POLLIN | POLLRDNORM)) {
/* read() capture */
return res | videobuf_poll_stream(file, &fh->vb_vidq, wait);
}
- poll_wait(file, &buf->vb.done, wait);
- if (buf->vb.state == VIDEOBUF_DONE ||
- buf->vb.state == VIDEOBUF_ERROR)
- return res | POLLIN | POLLRDNORM;
return res;
}