[libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call freeBuffer() on allocateBuffer() error

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Apr 17 00:11:21 CEST 2019


Hi Jacopo,

Thank you for the patch.

On Tue, Apr 16, 2019 at 03:42:06PM +0200, Jacopo Mondi wrote:
> Do not assume the freeBuffer() function can handle allocateBuffer()
> method failures, as error handling and clean up should be performed
> by allocateBuffer() method itself.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

I would however squash this with patch 2/7 as the freeBuffers() call is
added there.

> ---
>  src/libcamera/camera.cpp | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index 21caa24b90b5..2d0a80664214 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -650,7 +650,6 @@ int Camera::allocateBuffers()
>  	int ret = pipe_->allocateBuffers(this, activeStreams_);
>  	if (ret) {
>  		LOG(Camera, Error) << "Failed to allocate buffers";
> -		freeBuffers();
>  		return ret;
>  	}
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list