[{"id":1401,"web_url":"https://patchwork.libcamera.org/comment/1401/","msgid":"<20190416194250.GC28515@bigcity.dyn.berto.se>","date":"2019-04-16T19:42:50","subject":"Re: [libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call\n\tfreeBuffer() on allocateBuffer() error","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-04-16 15:42:06 +0200, Jacopo Mondi wrote:\n> Do not assume the freeBuffer() function can handle allocateBuffer()\n> method failures, as error handling and clean up should be performed\n> by allocateBuffer() method itself.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/camera.cpp | 1 -\n>  1 file changed, 1 deletion(-)\n> \n> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> index 21caa24b90b5..2d0a80664214 100644\n> --- a/src/libcamera/camera.cpp\n> +++ b/src/libcamera/camera.cpp\n> @@ -650,7 +650,6 @@ int Camera::allocateBuffers()\n>  \tint ret = pipe_->allocateBuffers(this, activeStreams_);\n>  \tif (ret) {\n>  \t\tLOG(Camera, Error) << \"Failed to allocate buffers\";\n> -\t\tfreeBuffers();\n>  \t\treturn ret;\n>  \t}\n>  \n> -- \n> 2.21.0\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-lf1-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D298F60004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 21:42:52 +0200 (CEST)","by mail-lf1-x144.google.com with SMTP id v1so7635352lfg.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 12:42:52 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tg79sm10609363lje.25.2019.04.16.12.42.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 16 Apr 2019 12:42:51 -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=a/zw+UdMHHB10XjxQiyIHtbMuAB5w0wFZxSCmeKCdf4=;\n\tb=fGf/pa7NGp06hDTxS+vuKk4TqVtG3QDvjtX3FuORVAZAVUlivP+Ekgbx/W2q8ph8aK\n\tPdwcJJWi/Sl6y6UuEkryLPkvsdqmDOs4Hqtv54Hr/03JUxkp3qk1DjFLug1Br+ahiMtG\n\t0vpyq8pnIWcrPEfcoMlN1Pq1Msv/FcS+DjjBIAgn7PjEy/pYrhnNkmVDHg67HeZpBrz0\n\tLjbMcfFkoAt6Buu8DfjXm5bE3/8RNVXMjrHau3kFCGwDBB9G4zrHvSwvLcTdhy5w0xYc\n\ttk4BQsSAXx2Jdl92ts1AvsiWIbdczHNsjBWw1XVP5MQDyV6wiuTZwMnD3qZW8C7LeEtG\n\t7zpg==","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=a/zw+UdMHHB10XjxQiyIHtbMuAB5w0wFZxSCmeKCdf4=;\n\tb=IbnDPx6WqEAxz9Ii/GDyPCrgCS6MMrwIDyV/ouupEiAZ4cvhQ+lThCp5zTvoYEqPCW\n\ttan3r3RouJiHIj5I2UjfC68681ApZ5yaIWI7sPojPny/OQ2k3D4C1qi7mAi0Ali613OL\n\t/9HSzLcDTSdJh3ioEcFQ0aLnj1S91vUtUwYK7ssJ4jA4++VIHhYzVUB+YggXv6SfyHrx\n\tQntXRc+8SGFUpSM0pPv4qCptxIIF7/Fu6N2Yi81ljQ4+kLwpEHy6F9JYWu91k9p0YZOW\n\tAQwBvEw0rvORJ6l1niyq8O/q7LH7/A96ttZ09ce6vm1QfjMV5tXHzhwAk0v/lXOlRjck\n\t47Nw==","X-Gm-Message-State":"APjAAAXVvZ2EF53hXPxNaAzGXpqzaZkpQur16+GXA2/tV3FInpE7/Kmu\n\tUIrFpkaCoQ/1e5d0b0AEIvT3Qg==","X-Google-Smtp-Source":"APXvYqxHBm3+Xz0+61GwWQhx/ATo1ICMl+B2YAQpEJdU4gSfRKsY8SPMPI0KYK4an1ZKZYvqtwI22w==","X-Received":"by 2002:ac2:592b:: with SMTP id\n\tv11mr21737844lfi.85.1555443772237; \n\tTue, 16 Apr 2019 12:42:52 -0700 (PDT)","Date":"Tue, 16 Apr 2019 21:42:50 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190416194250.GC28515@bigcity.dyn.berto.se>","References":"<20190416134210.21097-1-jacopo@jmondi.org>\n\t<20190416134210.21097-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190416134210.21097-4-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call\n\tfreeBuffer() on allocateBuffer() error","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":"Tue, 16 Apr 2019 19:42:53 -0000"}},{"id":1409,"web_url":"https://patchwork.libcamera.org/comment/1409/","msgid":"<20190416221121.GG4822@pendragon.ideasonboard.com>","date":"2019-04-16T22:11:21","subject":"Re: [libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call\n\tfreeBuffer() on allocateBuffer() error","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Apr 16, 2019 at 03:42:06PM +0200, Jacopo Mondi wrote:\n> Do not assume the freeBuffer() function can handle allocateBuffer()\n> method failures, as error handling and clean up should be performed\n> by allocateBuffer() method itself.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI would however squash this with patch 2/7 as the freeBuffers() call is\nadded there.\n\n> ---\n>  src/libcamera/camera.cpp | 1 -\n>  1 file changed, 1 deletion(-)\n> \n> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> index 21caa24b90b5..2d0a80664214 100644\n> --- a/src/libcamera/camera.cpp\n> +++ b/src/libcamera/camera.cpp\n> @@ -650,7 +650,6 @@ int Camera::allocateBuffers()\n>  \tint ret = pipe_->allocateBuffers(this, activeStreams_);\n>  \tif (ret) {\n>  \t\tLOG(Camera, Error) << \"Failed to allocate buffers\";\n> -\t\tfreeBuffers();\n>  \t\treturn ret;\n>  \t}\n>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B609B60004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 00:11:30 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 25602E2;\n\tWed, 17 Apr 2019 00:11:30 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555452690;\n\tbh=k3/GWS7vTTf7dkTQrbu/bwXihpIZjIfdL6rwUBwvdAc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wJVr81Q3z4GzG6uQvE2G22aZBEx2LW4HYffPwr9WreLCfDvFjTu8yygRaijIS1x5P\n\tsZjE5/isgc1JivHwO4Ijmq3DbEoXAA3izpPSNi+ZT2PPzg954iM0k9M9h/WmpDzX1r\n\tqSzKOjOZV6c7K5Mak0kJJ87Cr1JrGiQuGfNXvWHM=","Date":"Wed, 17 Apr 2019 01:11:21 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190416221121.GG4822@pendragon.ideasonboard.com>","References":"<20190416134210.21097-1-jacopo@jmondi.org>\n\t<20190416134210.21097-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190416134210.21097-4-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call\n\tfreeBuffer() on allocateBuffer() error","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":"Tue, 16 Apr 2019 22:11:31 -0000"}},{"id":1411,"web_url":"https://patchwork.libcamera.org/comment/1411/","msgid":"<20190416221533.GI4822@pendragon.ideasonboard.com>","date":"2019-04-16T22:15:33","subject":"Re: [libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call\n\tfreeBuffer() on allocateBuffer() error","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Wed, Apr 17, 2019 at 01:11:21AM +0300, Laurent Pinchart wrote:\n> On Tue, Apr 16, 2019 at 03:42:06PM +0200, Jacopo Mondi wrote:\n> > Do not assume the freeBuffer() function can handle allocateBuffer()\n> > method failures, as error handling and clean up should be performed\n> > by allocateBuffer() method itself.\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> I would however squash this with patch 2/7 as the freeBuffers() call is\n> added there.\n\nActually, don't you also need to fix\nPipelineHandlerIPU3::allocateBuffers() to cleanup in case of error ?\n\n> > ---\n> >  src/libcamera/camera.cpp | 1 -\n> >  1 file changed, 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> > index 21caa24b90b5..2d0a80664214 100644\n> > --- a/src/libcamera/camera.cpp\n> > +++ b/src/libcamera/camera.cpp\n> > @@ -650,7 +650,6 @@ int Camera::allocateBuffers()\n> >  \tint ret = pipe_->allocateBuffers(this, activeStreams_);\n> >  \tif (ret) {\n> >  \t\tLOG(Camera, Error) << \"Failed to allocate buffers\";\n> > -\t\tfreeBuffers();\n> >  \t\treturn ret;\n> >  \t}\n> >","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81A3860004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 00:15:42 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 329ACE2;\n\tWed, 17 Apr 2019 00:15:42 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555452942;\n\tbh=GjmFJEn23+fUnM/xDeOizlBVnk5XxUjMTMYsncxSAxw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pFtSXE4Tje9PNXm5hGWjD2SrarSIOECYSVVRKTxhwm6QWxQe0Mdl8wHOrZ7pxZxT0\n\tNX7bw+JPnwbtvo6wSb7WyVrUgvOqGRqQRjnZ2xXEHBI6FjhI5E4Yc/O4KfLGtfCAzz\n\tfhqmGyFGJX9V0SaU6NmNw83nYG/OnGS48w8ejHSI=","Date":"Wed, 17 Apr 2019 01:15:33 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190416221533.GI4822@pendragon.ideasonboard.com>","References":"<20190416134210.21097-1-jacopo@jmondi.org>\n\t<20190416134210.21097-4-jacopo@jmondi.org>\n\t<20190416221121.GG4822@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190416221121.GG4822@pendragon.ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v6 3/7] libcamera: camera: Don't call\n\tfreeBuffer() on allocateBuffer() error","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":"Tue, 16 Apr 2019 22:15:42 -0000"}}]