[libcamera-devel] [PATCH v5 2/7] libcamera: camera: Propagate freeBuffers() error

Jacopo Mondi jacopo at jmondi.org
Tue Apr 16 01:18:54 CEST 2019


The error return code of PipelineHandler::freeBuffers() was not
propagate up to applications by the Camera class. Fix this by returning
the incremental error accumulated by multiple calls (one per Stream)
to freeBuffers().

Do not return the error code of the call to freeBuffers() in the
allocateBuffers() method error path not to overwrite the original error
code returned from the allocation method.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/camera.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index bdf14b31d8ee..7f2dc904df16 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -671,6 +671,8 @@ int Camera::allocateBuffers()
  */
 int Camera::freeBuffers()
 {
+	int ret = 0;
+
 	if (!stateIs(CameraPrepared))
 		return -EACCES;
 
@@ -683,12 +685,12 @@ int Camera::freeBuffers()
 		 * by the V4L2 device that has allocated them.
 		 */
 		stream->bufferPool().destroyBuffers();
-		pipe_->freeBuffers(this, stream);
+		ret |= pipe_->freeBuffers(this, stream);
 	}
 
 	state_ = CameraConfigured;
 
-	return 0;
+	return ret;
 }
 
 /**
-- 
2.21.0



More information about the libcamera-devel mailing list