Show a patch.

GET /api/1.1/patches/17522/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 17522,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17522/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17522/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20221004021842.6345-3-laurent.pinchart@ideasonboard.com>",
    "date": "2022-10-04T02:18:42",
    "name": "[libcamera-devel,2/2] pipeline: rkisp1: Use utils::Cleaner to simplify error handling in start",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "797cfa28adc6e5ecb5454abb51310b37b1a8c074",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17522/mbox/",
    "series": [
        {
            "id": 3530,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3530/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3530",
            "date": "2022-10-04T02:18:40",
            "name": "libcamera: Simplify error handling with Cleaner class",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3530/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17522/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17522/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 6A4E2C327C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Oct 2022 02:18:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B260860A83;\n\tTue,  4 Oct 2022 04:18:49 +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 A00B3603F6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Oct 2022 04:18:48 +0200 (CEST)",
            "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 256769DE;\n\tTue,  4 Oct 2022 04:18:48 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664849929;\n\tbh=57uD8ABTeHqCUB1yX5Da460OcM4Bc+iWhUsCaW+Hkfs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=W99JEyMqsmlGK/xDPQV0Om2l+GwHHqBOt3cHIcKnQaQ2TdcEYGHlQsB7Al82jPloK\n\txfnvUyUWua9BoCd/ukRYRwRmRXFGd0ZjafDRcLh4+7SL/yFe9/ovP5Hj+a1Lar2gWu\n\tNq0Yq2lWMnZRR11epdT23o9IPSMuB8aIl963o3GVlZJwB54A2HyZ0U0vcvATF8HYNv\n\tkrGbU6/Oj4f1MdQns/DdTxEMduLsfXAPwM+WVlBcfMoGtM6q42K4FQZFctCRRSZoRK\n\th8NCo1kAxBzHD1LzNTrAMMQYjxycpXD5tHCmaX68GG3fYRT7oSzcaliak1i1UvYBjT\n\tMjwuNPDf3Hlkg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664849928;\n\tbh=57uD8ABTeHqCUB1yX5Da460OcM4Bc+iWhUsCaW+Hkfs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XWNlLP/7qTwuPBc5tHGCYoczB/PqYUuszR8dWUr/D2c03tUSIjqgmGaATg5LLNmme\n\ta5ktsBw7yXX8X4HnHBATyW6zJDHOC4sgOny5rLntmpSxjLbJ7Y0BqS2NlTPCXwtteG\n\tEEdSlBpEBa+NQKu2hgObLBRLcBqyR5hvPxhz7trE="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"XWNlLP/7\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  4 Oct 2022 05:18:42 +0300",
        "Message-Id": "<20221004021842.6345-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "In-Reply-To": "<20221004021842.6345-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20221004021842.6345-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] pipeline: rkisp1: Use utils::Cleaner\n\tto simplify error handling in start",
        "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>",
        "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Error handling in the PipelineHandlerRkISP1::start() function is\ncumbersome. Simplify it using the utils::Cleaner class.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 31 +++++++++---------------\n 1 file changed, 11 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 455ee2a0a711..33f3b0c5ab00 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -823,69 +823,60 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)\n int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlList *controls)\n {\n \tRkISP1CameraData *data = cameraData(camera);\n+\tutils::Cleaner cleaner;\n \tint ret;\n \n \t/* Allocate buffers for internal pipeline usage. */\n \tret = allocateBuffers(camera);\n \tif (ret)\n \t\treturn ret;\n+\tcleaner.defer([&]() { freeBuffers(camera); });\n \n \tret = data->ipa_->start();\n \tif (ret) {\n-\t\tfreeBuffers(camera);\n \t\tLOG(RkISP1, Error)\n \t\t\t<< \"Failed to start IPA \" << camera->id();\n \t\treturn ret;\n \t}\n+\tcleaner.defer([&]() { data->ipa_->stop(); });\n \n \tdata->frame_ = 0;\n \n \tret = param_->streamOn();\n \tif (ret) {\n-\t\tdata->ipa_->stop();\n-\t\tfreeBuffers(camera);\n \t\tLOG(RkISP1, Error)\n \t\t\t<< \"Failed to start parameters \" << camera->id();\n \t\treturn ret;\n \t}\n+\tcleaner.defer([&]() { param_->streamOff(); });\n \n \tret = stat_->streamOn();\n \tif (ret) {\n-\t\tparam_->streamOff();\n-\t\tdata->ipa_->stop();\n-\t\tfreeBuffers(camera);\n \t\tLOG(RkISP1, Error)\n \t\t\t<< \"Failed to start statistics \" << camera->id();\n \t\treturn ret;\n \t}\n+\tcleaner.defer([&]() { stat_->streamOff(); });\n \n \tif (data->mainPath_->isEnabled()) {\n \t\tret = mainPath_.start();\n-\t\tif (ret) {\n-\t\t\tparam_->streamOff();\n-\t\t\tstat_->streamOff();\n-\t\t\tdata->ipa_->stop();\n-\t\t\tfreeBuffers(camera);\n+\t\tif (ret)\n \t\t\treturn ret;\n-\t\t}\n+\t\tcleaner.defer([&]() { mainPath_.stop(); });\n \t}\n \n \tif (hasSelfPath_ && data->selfPath_->isEnabled()) {\n \t\tret = selfPath_.start();\n-\t\tif (ret) {\n-\t\t\tmainPath_.stop();\n-\t\t\tparam_->streamOff();\n-\t\t\tstat_->streamOff();\n-\t\t\tdata->ipa_->stop();\n-\t\t\tfreeBuffers(camera);\n+\t\tif (ret)\n \t\t\treturn ret;\n-\t\t}\n \t}\n \n \tisp_->setFrameStartEnabled(true);\n \n \tactiveCamera_ = camera;\n-\treturn ret;\n+\n+\tcleaner.clear();\n+\treturn 0;\n }\n \n void PipelineHandlerRkISP1::stopDevice(Camera *camera)\n",
    "prefixes": [
        "libcamera-devel",
        "2/2"
    ]
}