Show a patch.

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

{
    "id": 4153,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/4153/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4153/",
    "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": "<20200623100815.10674-10-jacopo@jmondi.org>",
    "date": "2020-06-23T10:07:59",
    "name": "[libcamera-devel,09/25] media: ov5647: Fix return value from read/write",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "6d71d6e4cab2315fc51023807fcaef9e85a0ee56",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": {
        "id": 15,
        "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api",
        "username": "jmondi",
        "first_name": "Jacopo",
        "last_name": "Mondi",
        "email": "jacopo@jmondi.org"
    },
    "mbox": "https://patchwork.libcamera.org/patch/4153/mbox/",
    "series": [
        {
            "id": 1030,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1030/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1030",
            "date": "2020-06-23T10:07:50",
            "name": "media: ov5647: Support RaspberryPi Camera Module v1",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1030/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4153/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4153/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F02D5609A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 12:05:38 +0200 (CEST)",
            "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E04AAC000F;\n\tTue, 23 Jun 2020 10:05:35 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.118.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "mchehab@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl,\n\tlaurent.pinchart@ideasonboard.com, roman.kovalivskyi@globallogic.com, \n\tdave.stevenson@raspberrypi.org, naush@raspberrypi.com",
        "Cc": "Jacopo Mondi <jacopo@jmondi.org>, mrodin@de.adit-jv.com,\n\thugues.fruchet@st.com, mripard@kernel.org, aford173@gmail.com,\n\tsudipi@jp.adit-jv.com, andrew_gabbasov@mentor.com,\n\terosca@de.adit-jv.com, \n\tlinux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 23 Jun 2020 12:07:59 +0200",
        "Message-Id": "<20200623100815.10674-10-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200623100815.10674-1-jacopo@jmondi.org>",
        "References": "<20200623100815.10674-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 09/25] media: ov5647: Fix return value\n\tfrom read/write",
        "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>",
        "X-List-Received-Date": "Tue, 23 Jun 2020 10:05:39 -0000"
    },
    "content": "The ov5647_read()/ov5647_write() return in case of success the number\nof bytes read or written respectively. This requires callers to check\nif the return value is less than zero to detect an error. Unfortunately,\nin several places, callers directly return the result of a read/write\ncall, causing issues when the returned valued is checked to be different\nfrom zero to detect an error.\n\nFix this by returning zero if i2c_master_send() and i2c_master_read()\nreturn a positive value (the number of bytes written or read).\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/i2c/ov5647.c | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c\nindex 61aa86e507b32..0c88f682de9b9 100644\n--- a/drivers/media/i2c/ov5647.c\n+++ b/drivers/media/i2c/ov5647.c\n@@ -204,11 +204,13 @@ static int ov5647_write(struct v4l2_subdev *sd, u16 reg, u8 val)\n \tint ret;\n \n \tret = i2c_master_send(client, data, 3);\n-\tif (ret < 0)\n+\tif (ret < 0) {\n \t\tdev_dbg(&client->dev, \"%s: i2c write error, reg: %x\\n\",\n \t\t\t\t__func__, reg);\n+\t\treturn ret;\n+\t}\n \n-\treturn ret;\n+\treturn 0;\n }\n \n static int ov5647_read(struct v4l2_subdev *sd, u16 reg, u8 *val)\n@@ -225,11 +227,13 @@ static int ov5647_read(struct v4l2_subdev *sd, u16 reg, u8 *val)\n \t}\n \n \tret = i2c_master_recv(client, val, 1);\n-\tif (ret < 0)\n+\tif (ret < 0) {\n \t\tdev_dbg(&client->dev, \"%s: i2c read error, reg: %x\\n\",\n \t\t\t\t__func__, reg);\n+\t\treturn ret;\n+\t}\n \n-\treturn ret;\n+\treturn 0;\n }\n \n static int ov5647_write_array(struct v4l2_subdev *sd,\n",
    "prefixes": [
        "libcamera-devel",
        "09/25"
    ]
}