From b3b77c9c434aa690bab8c2e598ecfe28b18d02e6 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 26 Nov 2010 16:19:34 +0100 Subject: 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 --- yavta.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'yavta.c') 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; -- cgit v1.2.3