{"id":24133,"url":"https://patchwork.libcamera.org/api/1.1/patches/24133/?format=json","web_url":"https://patchwork.libcamera.org/patch/24133/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250815113400.20623-4-laurent.pinchart@ideasonboard.com>","date":"2025-08-15T11:33:55","name":"[v2,3/8] pipeline: rkisp1: Replace error handling gotos with utils::exit_scope","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"1e010773f34052a4aec2ff562fdd9686ff63979f","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24133/mbox/","series":[{"id":5383,"url":"https://patchwork.libcamera.org/api/1.1/series/5383/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5383","date":"2025-08-15T11:33:52","name":"libcamera: Use span in FrameBuffer & assorted cleanups","version":2,"mbox":"https://patchwork.libcamera.org/series/5383/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24133/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24133/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A431EBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Aug 2025 11:34:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0FDE869263;\n\tFri, 15 Aug 2025 13:34:32 +0200 (CEST)","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 01EFA61443\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Aug 2025 13:34:25 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 02AC2605;\n\tFri, 15 Aug 2025 13:33:29 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jeZgBCYk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755257610;\n\tbh=nsbVr4+Y4gYjD5ICyepngMpK8g6aNzDw3bHDF/himBE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=jeZgBCYkCKUM/gl1kbjFpqo+6cvZhTadxbC3QbKlDkQUaOcb6tj/oY+hEUKAJyc3d\n\t6snGoZQ/7EXwBsOAdL8U0d8dS/dn7QKa9dRTzdio7gmV9lKxpreSR1hGadJu+HUE8s\n\t+tpHshIXByeGZSlCl2n8mF5v44WUtDFq18aG7uhg=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"=?utf-8?q?Daniel_R=C3=A1kos?= <daniel.rakos@rastergrid.com>","Subject":"[PATCH v2 3/8] pipeline: rkisp1: Replace error handling gotos with\n\tutils::exit_scope","Date":"Fri, 15 Aug 2025 14:33:55 +0300","Message-ID":"<20250815113400.20623-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.49.1","In-Reply-To":"<20250815113400.20623-1-laurent.pinchart@ideasonboard.com>","References":"<20250815113400.20623-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use utils::exit_scope in PipelineHandlerRkISP1::allocateBuffers() to\navoid gotos for error handling.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 81370f4cdcba..55d7d4442caf 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -1002,21 +1002,27 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \tunsigned int ipaBufferId = 1;\n \tint ret;\n \n+\tauto errorCleanup = utils::scope_exit{ [&]() {\n+\t\tparamBuffers_.clear();\n+\t\tstatBuffers_.clear();\n+\t\tmainPathBuffers_.clear();\n+\t} };\n+\n \tif (!isRaw_) {\n \t\tret = param_->allocateBuffers(kRkISP1MinBufferCount, &paramBuffers_);\n \t\tif (ret < 0)\n-\t\t\tgoto error;\n+\t\t\treturn ret;\n \n \t\tret = stat_->allocateBuffers(kRkISP1MinBufferCount, &statBuffers_);\n \t\tif (ret < 0)\n-\t\t\tgoto error;\n+\t\t\treturn ret;\n \t}\n \n \t/* If the dewarper is being used, allocate internal buffers for ISP. */\n \tif (useDewarper_) {\n \t\tret = mainPath_.exportBuffers(kRkISP1MinBufferCount, &mainPathBuffers_);\n \t\tif (ret < 0)\n-\t\t\tgoto error;\n+\t\t\treturn ret;\n \n \t\tfor (std::unique_ptr<FrameBuffer> &buffer : mainPathBuffers_)\n \t\t\tavailableMainPathBuffers_.push(buffer.get());\n@@ -1038,14 +1044,8 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \n \tdata->ipa_->mapBuffers(data->ipaBuffers_);\n \n+\terrorCleanup.release();\n \treturn 0;\n-\n-error:\n-\tparamBuffers_.clear();\n-\tstatBuffers_.clear();\n-\tmainPathBuffers_.clear();\n-\n-\treturn ret;\n }\n \n int PipelineHandlerRkISP1::freeBuffers(Camera *camera)\n","prefixes":["v2","3/8"]}