From nobody Mon Feb 9 07:52:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636402170255296.7485889790307; Mon, 8 Nov 2021 12:09:30 -0800 (PST) Received: from localhost ([::1]:60650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkAxM-000222-V5 for importer@patchew.org; Mon, 08 Nov 2021 15:09:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkAwG-0000Wk-Tn; Mon, 08 Nov 2021 15:08:20 -0500 Received: from mail.weilnetz.de ([37.120.169.71]:52288 helo=mail.v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkAwE-0005G7-Fu; Mon, 08 Nov 2021 15:08:20 -0500 Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by mail.v2201612906741603.powersrv.de (Postfix) with ESMTP id C16A1DA11FD; Mon, 8 Nov 2021 21:08:13 +0100 (CET) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id 31776460015; Mon, 8 Nov 2021 21:08:12 +0100 (CET) From: Stefan Weil To: qemu-devel@nongnu.org Subject: [PATCH] device_tree: Fix compiler error Date: Mon, 8 Nov 2021 21:07:56 +0100 Message-Id: <20211108200756.1302697-1-sw@weilnetz.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=37.120.169.71; envelope-from=stefan@weilnetz.de; helo=mail.v2201612906741603.powersrv.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Richard Henderson , Stefan Weil , Alistair Francis , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1636402172957100001 A build with gcc (Debian 10.2.1-6) 10.2.1 20210110 fails: ../../../softmmu/device_tree.c: In function =E2=80=98qemu_fdt_add_path=E2= =80=99: ../../../softmmu/device_tree.c:560:18: error: =E2=80=98retval=E2=80=99 may = be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] 560 | int namelen, retval; | ^~~~~~ This is not a real error, but the compiler can be satisfied with a small ch= ange. Fixes: b863f0b75852 ("device_tree: Add qemu_fdt_add_path") Signed-off-by: Stefan Weil Reviewed-by: Richard Henderson --- softmmu/device_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c index 3965c834ca..9e96f5ecd5 100644 --- a/softmmu/device_tree.c +++ b/softmmu/device_tree.c @@ -564,7 +564,7 @@ int qemu_fdt_add_path(void *fdt, const char *path) return -1; } =20 - while (p) { + do { name =3D p + 1; p =3D strchr(name, '/'); namelen =3D p !=3D NULL ? p - name : strlen(name); @@ -584,7 +584,7 @@ int qemu_fdt_add_path(void *fdt, const char *path) } =20 parent =3D retval; - } + } while (p); =20 return retval; } --=20 2.30.2