Show a patch.

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

{
    "id": 483,
    "url": "https://patchwork.libcamera.org/api/patches/483/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/483/",
    "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": "<20190203105517.5355-3-kieran.bingham@ideasonboard.com>",
    "date": "2019-02-03T10:55:14",
    "name": "[libcamera-devel,v2,2/5] libcamera: buffer: Fix setDmabuf operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "460e9e77ee33f1c61623b604836413a41f90d2a3",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/483/mbox/",
    "series": [
        {
            "id": 164,
            "url": "https://patchwork.libcamera.org/api/series/164/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=164",
            "date": "2019-02-03T10:55:12",
            "name": "libcamera: Buffer Objects",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/164/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/483/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/483/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@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 B8A3060DB5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 Feb 2019 11:55:21 +0100 (CET)",
            "from localhost.localdomain\n\t(218.182-78-194.adsl-static.isp.belgacom.be [194.78.182.218])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 53D7CD4A;\n\tSun,  3 Feb 2019 11:55:21 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549191321;\n\tbh=cTDa7n0mr9Kx1YntMoNasC58iWTcQWo6rIPhFluuJ7Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SZN14kJgvvTvIiBRV5CjYkjOSO/Dxq9n3oo7Hk+asgsHkATzyZf6FsuLNP7fsXF5g\n\tp6lxTwEYY94UsVxcwaQldJsfS9On0AanjTsyhS/hQRLMw975SA06zd6L9cxV/GzFD5\n\teZogvbQwxNQ9ZSq/M5aM3mdZfqNucy6O9y5zT1ec=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Sun,  3 Feb 2019 11:55:14 +0100",
        "Message-Id": "<20190203105517.5355-3-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.1",
        "In-Reply-To": "<20190203105517.5355-1-kieran.bingham@ideasonboard.com>",
        "References": "<20190203105517.5355-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 2/5] libcamera: buffer: Fix setDmabuf\n\toperations",
        "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, 03 Feb 2019 10:55:22 -0000"
    },
    "content": "The setDmabuf validation for the input FD was incorrect.\n\nFix this, and update the documentation and error reporting.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/buffer.cpp | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex 6dfebfc6bb28..c86847daf193 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -43,6 +43,8 @@ Buffer::~Buffer()\n  * \\brief Set the dmabuf file handle backing the buffer\n  *\n  * The \\a fd dmabuf file handle is duplicated and stored.\n+ *\n+ * \\return 0 on success or a negative error value otherwise.\n  */\n int Buffer::setDmabuf(int fd)\n {\n@@ -51,12 +53,19 @@ int Buffer::setDmabuf(int fd)\n \t\tfd_ = -1;\n \t}\n \n-\tif (fd != -1)\n-\t\treturn 0;\n+\tif (fd < 0) {\n+\t\tLOG(Buffer, Error) << \"Invalid DMABuf FD provided\";\n+\t\treturn -EINVAL;\n+\t}\n \n \tfd_ = dup(fd);\n-\tif (fd_ == -1)\n-\t\treturn -errno;\n+\tif (fd_ == -1) {\n+\t\tint ret = -errno;\n+\t\tLOG(Buffer, Error)\n+\t\t\t<< \"Failed to duplicate Dmabuf: \" << strerror(-ret);\n+\n+\t\treturn ret;\n+\t}\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/5"
    ]
}