[{"id":2244,"web_url":"https://patchwork.libcamera.org/comment/2244/","msgid":"<20190714070628.GB31025@wyvern>","date":"2019-07-14T07:06:28","subject":"Re: [libcamera-devel] [PATCH v2 02/16] libcamera: camera: Don't\n\tcheck buffer count before freeing buffers","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2019-07-13 20:23:37 +0300, Laurent Pinchart wrote:\n> There's no need to check if buffers have been allocated before freeing\n> them as the BufferPool::destroyBuffers() method is a no-op when no\n> buffers have been allocated. Document this fact explicitly, and remove\n> the buffer count check.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/buffer.cpp | 3 +++\n>  src/libcamera/camera.cpp | 3 ---\n>  2 files changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\n> index d86278a8a90a..c0a020942f5c 100644\n> --- a/src/libcamera/buffer.cpp\n> +++ b/src/libcamera/buffer.cpp\n> @@ -311,6 +311,9 @@ void BufferPool::createBuffers(unsigned int count)\n>  \n>  /**\n>   * \\brief Release all buffers from pool\n> + *\n> + * If no buffers have been created or if buffers have already been released no\n> + * operation is performed.\n>   */\n>  void BufferPool::destroyBuffers()\n>  {\n> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> index 094f1b63b7f1..810cb1295f34 100644\n> --- a/src/libcamera/camera.cpp\n> +++ b/src/libcamera/camera.cpp\n> @@ -740,9 +740,6 @@ int Camera::freeBuffers()\n>  \t\treturn -EACCES;\n>  \n>  \tfor (Stream *stream : activeStreams_) {\n> -\t\tif (!stream->bufferPool().count())\n> -\t\t\tcontinue;\n> -\n>  \t\t/*\n>  \t\t * All mappings must be destroyed before buffers can be freed\n>  \t\t * by the V4L2 device that has allocated them.\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-pf1-x443.google.com (mail-pf1-x443.google.com\n\t[IPv6:2607:f8b0:4864:20::443])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 86FF160E3F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Jul 2019 09:06:33 +0200 (CEST)","by mail-pf1-x443.google.com with SMTP id r1so6023100pfq.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Jul 2019 00:06:33 -0700 (PDT)","from localhost (softbank126159224182.bbtec.net. [126.159.224.182])\n\tby smtp.gmail.com with ESMTPSA id\n\tz20sm20345126pfk.72.2019.07.14.00.06.30\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tSun, 14 Jul 2019 00:06:31 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=5EPT6MJEaV6sHCsFLSnIU/fdB1uHzuWPUhZ2qhevUs4=;\n\tb=bRcbjrHMCVSkm1omOgn+Bf8pIL1UdjaM7U9vQQaTh+pe159qvYBvX6LLV/LJ0g9bII\n\tGXxAQdUkx8B8VolKuWupIq7L4/qAXB0Idj/g6h96vvfSrnu7+Kb7gY5aNtT8g6PN3I1K\n\tKPh1jAPt7vUjG7lHNQWwnH1ItzFdTaD96RwZgYUvV9oNeTMyGQlufTd7/TRUV6gfYZ5a\n\tDO9Qeh5U3IxpsqKGTb8ILHWpakpGyZjHzPba+deIMgkQN6TgTXoWXyzx6fYmFLKDDaJB\n\tElc+d5zFUzS3JPKYeoKacc0eR5BlD33iN7hHkPAeUiurqBMTvh+UK5P5DJAoZgibORqA\n\tC04g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=5EPT6MJEaV6sHCsFLSnIU/fdB1uHzuWPUhZ2qhevUs4=;\n\tb=AP+3t+s/mI0QcqCimotPYI9M2ONChOE+tX9Ac4t3K5RoQlmdpGPRGGlQL+Rf4kPszM\n\tlhxjC/4mAdv3VtzUQYR/wpUCVrToTzuM6rexAP81kV6uB7AOFSz3CY9dejXoJgQRFfc1\n\tQT+M2V1D1UEQJuLwKIM0NKyRUUvXepoQKtp4aClrJlaVh4VrrZSKmJL2BKuedsq3Sm6E\n\t1iHSQJLSEEh8iQ/kaWhkjfRJOkKLQeUeThPVYmAttliXVUO5XXd8wndWuSht/ve06nRy\n\tkf0bHWd/QbbvALybu6IHqSvk9JM7JfxaHHBK/Ph4tNoazoiHhXNAWcH2zBgBi8+hSJAG\n\tKRAw==","X-Gm-Message-State":"APjAAAUE7gEtHe669MI35Df1U8FtGvYTJfsNYm1q7GGqQKh+I3NOIyz9\n\tsNY+PJeP9cHra4uxcL9RzYcfs6M9KjEwdA==","X-Google-Smtp-Source":"APXvYqxofClKVGSYl+2Sc4K/0nKGgfbwrcetR0y7vlzAexb9+WmEVckZGIDVSjBN9UkasB7vhJGhbQ==","X-Received":"by 2002:a17:90a:8c90:: with SMTP id\n\tb16mr21943588pjo.133.1563087992327; \n\tSun, 14 Jul 2019 00:06:32 -0700 (PDT)","Date":"Sun, 14 Jul 2019 16:06:28 +0900","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190714070628.GB31025@wyvern>","References":"<20190713172351.25452-1-laurent.pinchart@ideasonboard.com>\n\t<20190713172351.25452-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190713172351.25452-3-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 02/16] libcamera: camera: Don't\n\tcheck buffer count before freeing buffers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sun, 14 Jul 2019 07:06:34 -0000"}}]