public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [yavta PATCH] Return proper error code if STREAMON fails
@ 2015-11-30 14:46 Tuukka Toivonen
  2015-12-12 15:40 ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Tuukka Toivonen @ 2015-11-30 14:46 UTC (permalink / raw)
  To: linux-media; +Cc: laurent.pinchart

Fix the bug causing success to be returned even if VIDIOC_STREAMON
failed. Also check returned error from VIDIOC_STREAMOFF.

Signed-off-by: Tuukka Toivonen <tuukka.toivonen@intel.com>
---
 yavta.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/yavta.c b/yavta.c
index b627725..3ad1c97 100644
--- a/yavta.c
+++ b/yavta.c
@@ -1623,7 +1623,7 @@ static int video_do_capture(struct device *dev, 
unsigned int nframes,
 	unsigned int i;
 	double bps;
 	double fps;
-	int ret;
+	int ret, ret2;
 
 	/* Start streaming. */
 	ret = video_enable(dev, 1);
@@ -1708,7 +1708,9 @@ static int video_do_capture(struct device *dev, 
unsigned int nframes,
 	}
 
 	/* Stop streaming. */
-	video_enable(dev, 0);
+	ret = video_enable(dev, 0);
+	if (ret < 0)
+		goto done;
 
 	if (nframes == 0) {
 		printf("No frames captured.\n");
@@ -1732,7 +1734,11 @@ static int video_do_capture(struct device *dev, 
unsigned int nframes,
 		i, ts.tv_sec, ts.tv_nsec/1000, fps, bps);
 
 done:
-	return video_free_buffers(dev);
+	ret2 = video_free_buffers(dev);
+	if (ret >= 0)
+		ret = ret2;
+
+	return ret;
 }
 
 #define V4L_BUFFERS_DEFAULT	8
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-14 18:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-30 14:46 [yavta PATCH] Return proper error code if STREAMON fails Tuukka Toivonen
2015-12-12 15:40 ` Laurent Pinchart
2015-12-14  7:16   ` Tuukka Toivonen
2015-12-14  7:49     ` [yavta PATCH v2] " Tuukka Toivonen
2015-12-14 18:40       ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox