Show a patch.

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

{
    "id": 9164,
    "url": "https://patchwork.libcamera.org/api/patches/9164/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9164/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20200803230328.1125040-1-niklas.soderlund@ragnatech.se>",
    "date": "2020-08-03T23:03:28",
    "name": "[libcamera-devel] cam: Use the common cleanup function on failure",
    "commit_ref": "1074604c9e2b6d9afa0247f2ca62b3140131d639",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6d59127ae8fcc1f5643ed05df5e431704edcdbe5",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9164/mbox/",
    "series": [
        {
            "id": 1186,
            "url": "https://patchwork.libcamera.org/api/series/1186/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1186",
            "date": "2020-08-03T23:03:28",
            "name": "[libcamera-devel] cam: Use the common cleanup function on failure",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1186/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9164/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9164/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 77510BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Aug 2020 23:03:47 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 013A56092F;\n\tTue,  4 Aug 2020 01:03:46 +0200 (CEST)",
            "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 516E560393\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Aug 2020 01:03:45 +0200 (CEST)",
            "from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de\n\t[84.172.82.168]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 5bd21b8a-d5dd-11ea-86ee-0050569116f7;\n\tTue, 04 Aug 2020 01:02:20 +0200 (CEST)"
        ],
        "X-Halon-ID": "5bd21b8a-d5dd-11ea-86ee-0050569116f7",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  4 Aug 2020 01:03:28 +0200",
        "Message-Id": "<20200803230328.1125040-1-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.28.0",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] cam: Use the common cleanup function on\n\tfailure",
        "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>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The different error paths in init() are out of sync. Instead of fixing\nthem switch to using the cleanup() function which does to right thing in\nfor all cases.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/cam/main.cpp | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex ec59e9eaf1176a94..6761d63801bd19af 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -107,22 +107,23 @@ int CamApp::init(int argc, char **argv)\n \t\t\tstd::cout << \"Camera \"\n \t\t\t\t  << std::string(options_[OptCamera])\n \t\t\t\t  << \" not found\" << std::endl;\n-\t\t\tcm_->stop();\n+\t\t\tcleanup();\n \t\t\treturn -ENODEV;\n \t\t}\n \n \t\tif (camera_->acquire()) {\n \t\t\tstd::cout << \"Failed to acquire camera\" << std::endl;\n-\t\t\tcamera_.reset();\n-\t\t\tcm_->stop();\n+\t\t\tcleanup();\n \t\t\treturn -EINVAL;\n \t\t}\n \n \t\tstd::cout << \"Using camera \" << camera_->name() << std::endl;\n \n \t\tret = prepareConfig();\n-\t\tif (ret)\n+\t\tif (ret) {\n+\t\t\tcleanup();\n \t\t\treturn ret;\n+\t\t}\n \t}\n \n \tif (options_.isSet(OptMonitor)) {\n",
    "prefixes": [
        "libcamera-devel"
    ]
}