[libcamera-devel] [PATCH v1 2/2] pipeline: raspberrypi: Do not unconditionally free buffers on close

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Oct 28 15:45:56 CEST 2022


Quoting Naushir Patuck via libcamera-devel (2022-10-28 12:52:00)
> When a camera is terminated, do not unconditionally free buffers in the
> RPiCameraData destructor. Otherwise, this causes harmless error log messages
> to be displayed if no buffer have previously been allocated.
> 

Much like the V4L2 patch, I would think putting this check into
the beginning of void RPiCameraData::freeBuffers() would be safer.

I see freeBuffers is called a few times, (configure, start), which I
presume already ensure they are allocated ... but catching this for sure
for all cases could make sense.

Anyway, that's up to you, however you prefer:

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 343f8cb2c7ed..31107e1338bf 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -191,7 +191,8 @@ public:
>  
>         ~RPiCameraData()
>         {
> -               freeBuffers();
> +               if (buffersAllocated_)
> +                       freeBuffers();
>         }
>  
>         void freeBuffers();
> -- 
> 2.25.1
>


More information about the libcamera-devel mailing list