Show a patch.

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

{
    "id": 20454,
    "url": "https://patchwork.libcamera.org/api/patches/20454/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20454/",
    "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": "<20240628093643.2896445-1-stefan.klug@ideasonboard.com>",
    "date": "2024-06-28T09:36:02",
    "name": "[v2] libcamera: Fix maybe-uninitialized error",
    "commit_ref": "9411578be8c84c9e5727dbde9e51a885c6e9fea1",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7780e29ba8c320f761d9f17ce682bd98b1878b6f",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20454/mbox/",
    "series": [
        {
            "id": 4428,
            "url": "https://patchwork.libcamera.org/api/series/4428/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4428",
            "date": "2024-06-28T09:36:02",
            "name": "[v2] libcamera: Fix maybe-uninitialized error",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4428/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20454/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20454/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 A6C31BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Jun 2024 09:37:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1640662C99;\n\tFri, 28 Jun 2024 11:37:16 +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 1EDDD619D7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Jun 2024 11:37:15 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:82ab:924:d918:cd24])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6DE20735;\n\tFri, 28 Jun 2024 11:36:50 +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=\"OBX2R6Th\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719567410;\n\tbh=TEox59vhHbeE1C+8V/crhHPzx2vvRawGf/4qTthadbs=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=OBX2R6ThihuB/WpGG4iVzpEL1rJM+5AWkY4ln5BZds668AKuh6gtNGs/ZNm6orm/m\n\tfcV7PsYX3H9T24YhADIG90Ztc1YGgr966TN4sRJ8EaI71BC8lkq1whXYNOPNY+WieS\n\tsFvOktyf8lOpbpkdiXHLqrikrr9cQBNChOuWYwo8=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>",
        "Subject": "[PATCH v2] libcamera: Fix maybe-uninitialized error",
        "Date": "Fri, 28 Jun 2024 11:36:02 +0200",
        "Message-ID": "<20240628093643.2896445-1-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "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": "The gcc used in my current buildroot (Version 12.3) errors out with\n-Wmaybe-uninitialized. Fix that.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\nChanges in v2:\n- Changed the error handling in AwbConfg::read as proposed by Naushir\n- Removed unnecessary rewrapping of a comment\n\n src/ipa/libipa/exposure_mode_helper.cpp   | 9 +++------\n src/ipa/rpi/controller/rpi/awb.cpp        | 2 +-\n src/libcamera/device_enumerator_sysfs.cpp | 2 +-\n src/libcamera/pipeline/rpi/vc4/vc4.cpp    | 2 +-\n 4 files changed, 6 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp\nindex 683a564a01c8..7703becc4766 100644\n--- a/src/ipa/libipa/exposure_mode_helper.cpp\n+++ b/src/ipa/libipa/exposure_mode_helper.cpp\n@@ -166,7 +166,7 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const\n \t\treturn { minShutter_, minGain_, exposure / (minShutter_ * minGain_) };\n \n \tutils::Duration shutter;\n-\tdouble stageGain;\n+\tdouble stageGain = 1.0;\n \tdouble gain;\n \n \tfor (unsigned int stage = 0; stage < gains_.size(); stage++) {\n@@ -201,12 +201,9 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const\n \t * From here on all we can do is max out the shutter time, followed by\n \t * the analogue gain. If we still haven't achieved the target we send\n \t * the rest of the exposure time to digital gain. If we were given no\n-\t * stages to use then set stageGain to 1.0 so that shutter time is maxed\n-\t * before gain touched at all.\n+\t * stages to use then the default stageGain of 1.0 is used so that\n+\t * shutter time is maxed before gain is touched at all.\n \t */\n-\tif (gains_.empty())\n-\t\tstageGain = 1.0;\n-\n \tshutter = clampShutter(exposure / clampGain(stageGain));\n \tgain = clampGain(exposure / shutter);\n \ndiff --git a/src/ipa/rpi/controller/rpi/awb.cpp b/src/ipa/rpi/controller/rpi/awb.cpp\nindex 003c8fa137f3..f45525bce2d1 100644\n--- a/src/ipa/rpi/controller/rpi/awb.cpp\n+++ b/src/ipa/rpi/controller/rpi/awb.cpp\n@@ -122,7 +122,7 @@ int AwbConfig::read(const libcamera::YamlObject &params)\n \t\t}\n \t\tif (priors.empty()) {\n \t\t\tLOG(RPiAwb, Error) << \"AwbConfig: no AWB priors configured\";\n-\t\t\treturn ret;\n+\t\t\treturn -EINVAL;\n \t\t}\n \t}\n \tif (params.contains(\"modes\")) {\ndiff --git a/src/libcamera/device_enumerator_sysfs.cpp b/src/libcamera/device_enumerator_sysfs.cpp\nindex fc33ba52b813..7866885c0f73 100644\n--- a/src/libcamera/device_enumerator_sysfs.cpp\n+++ b/src/libcamera/device_enumerator_sysfs.cpp\n@@ -33,7 +33,7 @@ int DeviceEnumeratorSysfs::init()\n int DeviceEnumeratorSysfs::enumerate()\n {\n \tstruct dirent *ent;\n-\tDIR *dir;\n+\tDIR *dir = nullptr;\n \n \tstatic const char * const sysfs_dirs[] = {\n \t\t\"/sys/subsystem/media/devices\",\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 4a89e35f5d7b..e5b6ef2b37cd 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -802,7 +802,7 @@ void Vc4CameraData::ispInputDequeue(FrameBuffer *buffer)\n void Vc4CameraData::ispOutputDequeue(FrameBuffer *buffer)\n {\n \tRPi::Stream *stream = nullptr;\n-\tunsigned int index;\n+\tunsigned int index = 0;\n \n \tif (!isRunning())\n \t\treturn;\n",
    "prefixes": [
        "v2"
    ]
}