{"id":20429,"url":"https://patchwork.libcamera.org/api/1.1/patches/20429/?format=json","web_url":"https://patchwork.libcamera.org/patch/20429/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240627133730.2554717-1-stefan.klug@ideasonboard.com>","date":"2024-06-27T13:31:00","name":"libcamera: fix maybe-uninitialized error","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0aa1f1eadd171b2ba7f5e71d44bc8d966d57e809","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20429/mbox/","series":[{"id":4424,"url":"https://patchwork.libcamera.org/api/1.1/series/4424/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4424","date":"2024-06-27T13:31:00","name":"libcamera: fix maybe-uninitialized error","version":1,"mbox":"https://patchwork.libcamera.org/series/4424/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20429/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20429/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 0B04EBDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 Jun 2024 13:37:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B364B62C9D;\n\tThu, 27 Jun 2024 15:37:57 +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 8D14462C95\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Jun 2024 15:37:56 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:6248:8b4b:42bc:2b84])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AECC0593;\n\tThu, 27 Jun 2024 15:37:32 +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=\"u74kO2kx\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719495452;\n\tbh=jtOGT/tfrZE0dkn6yoPlCN87o9GtZqQGAhUroo/BD70=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=u74kO2kxuVA5wAkak8qPymz3cOyDqsTwA4DWox61YRJhxjpdqFWgEUH876a67DBgW\n\tCYl81RPRWd1CVysU3X6nAwXVFKYnNSnNqifwDM5SD8DquqqVpFV0g3WkY0Our7WPso\n\tU3OtHeN+ckw6RmK1Q7AQ/MwR1mFd3GujhCn9HP54=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH] libcamera: fix maybe-uninitialized error","Date":"Thu, 27 Jun 2024 15:31:00 +0200","Message-ID":"<20240627133730.2554717-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>\n---\n\n@Naush: Could you have a look at the rpi specific changes? Specifically\nI'm not sure if the change in AwbConfig::read() is correct. It was\nunclear to me if there are cases where line 125 should return 0 even\nthough a error got logged one line above.\n\nRegards,\nStefan\n\n\n src/ipa/libipa/exposure_mode_helper.cpp   | 15 ++++++---------\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, 9 insertions(+), 12 deletions(-)","diff":"diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp\nindex 683a564a01c8..9d1387636d05 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@@ -198,15 +198,12 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const\n \t}\n \n \t/*\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 * From here on all we can do is max out the shutter time, followed by the\n+\t * analogue gain. If we still haven't achieved the target we send the rest\n+\t * of the exposure time to digital gain. If we were given no stages to use\n+\t * then the default stageGain of 1.0 is used so that shutter time is maxed\n+\t * 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..3503a5ab9218 100644\n--- a/src/ipa/rpi/controller/rpi/awb.cpp\n+++ b/src/ipa/rpi/controller/rpi/awb.cpp\n@@ -91,7 +91,7 @@ static int readCtCurve(ipa::Pwl &ctR, ipa::Pwl &ctB, const libcamera::YamlObject\n \n int AwbConfig::read(const libcamera::YamlObject &params)\n {\n-\tint ret;\n+\tint ret = 0;\n \n \tbayes = params[\"bayes\"].get<int>(1);\n \tframePeriod = params[\"frame_period\"].get<uint16_t>(10);\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":[]}