libcamera: camera: Don't check buffer count before freeing buffers

There's no need to check if buffers have been allocated before freeing
them as the BufferPool::destroyBuffers() method is a no-op when no
buffers have been allocated. Document this fact explicitly, and remove
the buffer count check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-07-12 21:13:57 +03:00
parent e8e80bfa8d
commit a775234d66
2 changed files with 3 additions and 3 deletions

View file

@ -311,6 +311,9 @@ void BufferPool::createBuffers(unsigned int count)
/** /**
* \brief Release all buffers from pool * \brief Release all buffers from pool
*
* If no buffers have been created or if buffers have already been released no
* operation is performed.
*/ */
void BufferPool::destroyBuffers() void BufferPool::destroyBuffers()
{ {

View file

@ -740,9 +740,6 @@ int Camera::freeBuffers()
return -EACCES; return -EACCES;
for (Stream *stream : activeStreams_) { for (Stream *stream : activeStreams_) {
if (!stream->bufferPool().count())
continue;
/* /*
* All mappings must be destroyed before buffers can be freed * All mappings must be destroyed before buffers can be freed
* by the V4L2 device that has allocated them. * by the V4L2 device that has allocated them.