{"id":742,"url":"https://patchwork.libcamera.org/api/1.1/patches/742/?format=json","web_url":"https://patchwork.libcamera.org/patch/742/","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":"<20190319113532.18400-1-kieran.bingham@ideasonboard.com>","date":"2019-03-19T11:35:32","name":"[libcamera-devel] libcamera: media_device: Initialise local variable","commit_ref":"18647a532483470d9f64bc6cb1bbeeda39c2670d","pull_url":null,"state":"accepted","archived":false,"hash":"905dcd5eb3c67d4161e1726590dccf35ca0193ba","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/742/mbox/","series":[{"id":210,"url":"https://patchwork.libcamera.org/api/1.1/series/210/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=210","date":"2019-03-19T11:35:32","name":"[libcamera-devel] libcamera: media_device: Initialise local variable","version":1,"mbox":"https://patchwork.libcamera.org/series/210/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/742/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/742/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 C1233600FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Mar 2019 12:35:36 +0100 (CET)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 352D433A;\n\tTue, 19 Mar 2019 12:35:36 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1552995336;\n\tbh=ZlfK2gFlHOAIvSQDA9yqRbsUDL0bkJxQSG3SV1U2ozQ=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Ogjho4GKhANufOsRqtQC/+H8BjVvACdrZUF7d03qM8TRUjFlUHG2WpviRijO4jBnK\n\tP63slLQTsE0UBCZMOWUOT9uEK0ZHIMzhDD2jGOuH+G5AB8tL/W4oa4hfyLjdj6w6OU\n\tfuXIQWy5Z0PY98D+CxAWJyLrAhje++da4Sq34YjM=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Tue, 19 Mar 2019 11:35:32 +0000","Message-Id":"<20190319113532.18400-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.19.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: media_device: Initialise local\n\tvariable","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":"Tue, 19 Mar 2019 11:35:37 -0000"},"content":"The local variable ifaceId generates a compiler warning that it is used\nwithout initialisation.\n\nThe loop, and check against the loop iterator, and the\ntopology.num_interfaces actually ensures that this isn't the case, and\nthat ifaceId can only be used when set to a valid ID.\n\nThe media_v2_interface.id field documents the ID as simply \"Unique ID\nfor the interface\" but does not specify if zero is a valid ID or not. As\nsuch we don't further check the pre-initialised ID for validity and keep\nthe existing check on the iterator count to determine if the ID had been\ndiscovered successfully.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/media_device.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex ea4608932834..1e9024bf9721 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -516,7 +516,7 @@ struct media_v2_interface *MediaDevice::findInterface(const struct media_v2_topo\n {\n \tstruct media_v2_link *links = reinterpret_cast<struct media_v2_link *>\n \t\t\t\t\t\t      (topology.ptr_links);\n-\tunsigned int ifaceId;\n+\tunsigned int ifaceId = 0;\n \tunsigned int i;\n \n \tfor (i = 0; i < topology.num_links; ++i) {\n","prefixes":["libcamera-devel"]}