[libcamera-devel] pipeline: raspberrypi: Do not unconditionally free buffers on close
diff mbox series

Message ID 20221028135110.13433-1-naush@raspberrypi.com
State Accepted
Commit 30d704732badc675f72fe73d14749669cb645c23
Headers show
Series
  • [libcamera-devel] pipeline: raspberrypi: Do not unconditionally free buffers on close
Related show

Commit Message

Naushir Patuck Oct. 28, 2022, 1:51 p.m. UTC
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.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 343f8cb2c7ed..1b599fcc9ecf 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1506,6 +1506,9 @@  void PipelineHandlerRPi::mapBuffers(Camera *camera, const RPi::BufferMap &buffer
 
 void RPiCameraData::freeBuffers()
 {
+	if (!buffersAllocated_)
+		return;
+
 	if (ipa_) {
 		/*
 		 * Copy the buffer ids from the unordered_set to a vector to