[libcamera-devel,6/9] libcamera: camera: Propagate error value from importFrameBuffer

Message ID 20200314235728.15495-7-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Simplify buffer management with V4L2 buffer orphaning
Related show

Commit Message

Laurent Pinchart March 14, 2020, 11:57 p.m. UTC
The PipelineHandler::importFrameBuffer() function, called by
Camera::start() may return an error, but its return value is ignored.
Propagate it to the caller to fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/camera.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund March 16, 2020, 3:38 p.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2020-03-15 01:57:25 +0200, Laurent Pinchart wrote:
> The PipelineHandler::importFrameBuffer() function, called by
> Camera::start() may return an error, but its return value is ignored.
> Propagate it to the caller to fix this.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  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 63b1f7729937..9c432adb1d97 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -931,8 +931,10 @@ int Camera::start()
>  		if (allocator_ && !allocator_->buffers(stream).empty())
>  			continue;
>  
> -		p_->pipe_->invokeMethod(&PipelineHandler::importFrameBuffers,
> -					ConnectionTypeDirect, this, stream);
> +		ret = p_->pipe_->invokeMethod(&PipelineHandler::importFrameBuffers,
> +					      ConnectionTypeDirect, this, stream);
> +		if (ret < 0)
> +			return ret;
>  	}
>  
>  	ret = p_->pipe_->invokeMethod(&PipelineHandler::start,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 63b1f7729937..9c432adb1d97 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -931,8 +931,10 @@  int Camera::start()
 		if (allocator_ && !allocator_->buffers(stream).empty())
 			continue;
 
-		p_->pipe_->invokeMethod(&PipelineHandler::importFrameBuffers,
-					ConnectionTypeDirect, this, stream);
+		ret = p_->pipe_->invokeMethod(&PipelineHandler::importFrameBuffers,
+					      ConnectionTypeDirect, this, stream);
+		if (ret < 0)
+			return ret;
 	}
 
 	ret = p_->pipe_->invokeMethod(&PipelineHandler::start,