summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-11-26 16:19:34 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-11-26 16:19:34 +0100
commitb3b77c9c434aa690bab8c2e598ecfe28b18d02e6 (patch)
treeb67ce698a927861ecd09d446a6bf7066b24e2e94
parent7787c8ef296807cd11e853cea7b0b92d9f9b3623 (diff)
Fix uninitialized variable warning in video_do_capture()
Make sure the variable won't be use uninitialized and silent the warning. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--yavta.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/yavta.c b/yavta.c
index 57dfa8c..f272a64 100644
--- a/yavta.c
+++ b/yavta.c
@@ -806,7 +806,8 @@ static int video_do_capture(struct device *dev, unsigned int nframes,
int do_requeue_last)
{
char *filename = NULL;
- struct timeval start, end, ts;
+ struct timeval start = { 0, 0 };
+ struct timeval end, ts;
struct v4l2_buffer buf;
unsigned int size;
unsigned int i;
@@ -891,6 +892,11 @@ static int video_do_capture(struct device *dev, unsigned int nframes,
/* Stop streaming. */
video_enable(dev, 0);
+ if (nframes == 0) {
+ printf("No frames captured.\n");
+ goto done;
+ }
+
if (end.tv_sec == start.tv_sec && end.tv_usec == start.tv_usec)
goto done;