From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.groups.io with SMTP id smtpd.web11.20669.1585163478351727519 for ; Wed, 25 Mar 2020 12:11:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d2kIkTkt; spf=pass (domain: redhat.com, ip: 63.128.21.74, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585163477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t50+Yq3cL2fSpUDCM6sbC7OOSumy/Vr1Usv/3E8np2I=; b=d2kIkTktJDv68Lje7UIzVZ605MqrG7ancF1Y6f3uNE5S7zOHbpfDw+ykcZ9Xl4r9kGPeRv SxDdK0RZMMfKVjuDjHw3Rf5k64Xm+bmSrvVUXZS7KNSakjrxG6VMJ4+IUiSvcthuk7YcB2 sOxBWmJglhwTb9gOx+t42bJPHbq3+2k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-3eW5hxtrPjqpH9-Bleq-cg-1; Wed, 25 Mar 2020 15:11:12 -0400 X-MC-Unique: 3eW5hxtrPjqpH9-Bleq-cg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87DC28017CE; Wed, 25 Mar 2020 19:11:11 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-153.ams2.redhat.com [10.36.113.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4A015C1D4; Wed, 25 Mar 2020 19:11:10 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] ArmVirtPkg/PlatformPeiLib: add dummy assignment to work around older GCC To: devel@edk2.groups.io, ard.biesheuvel@linaro.org References: <20200325093334.24793-1-ard.biesheuvel@linaro.org> From: "Laszlo Ersek" Message-ID: <49216154-35d3-b03e-7f2b-b2280d39c3fe@redhat.com> Date: Wed, 25 Mar 2020 20:11:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200325093334.24793-1-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/25/20 10:33, Ard Biesheuvel wrote: > Older GCC (<=3D 4.9) fail to infer that Parent is never used unless it > has been assigned before, and may throw an error like >=20 > /work/git/edk2/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c: > In function =E2=80=98PlatformPeim=E2=80=99: > /work/git/edk2/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c:132:2= 4: > error: =E2=80=98Parent=E2=80=99 may be used uninitialized in this f= unction > [-Werror=3Dmaybe-uninitia= lized] > RangesProp =3D fdt_getprop (Base, Parent, "ranges", &RangesL= en); >=20 > Set Parent to 0 at the start of the sequence to work around this. >=20 > Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2601 > Fixes: 82662a3b5f56e974 ("ArmVirtPkg/PlatformPeiLib: discover the TPM bas= e ...") > Signed-off-by: Ard Biesheuvel > --- > ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirt= Pkg/Library/PlatformPeiLib/PlatformPeiLib.c > index 8b5b3dd5dc1c..6c4028e17995 100644 > --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c > +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c > @@ -77,6 +77,11 @@ PlatformPeim ( > =20 > TpmBase =3D 0; > =20 > + // > + // Set Parent to suppress incorrect compiler/analyzer warnings. > + // > + Parent =3D 0; > + > for (Prev =3D Depth =3D 0;; Prev =3D Node) { > Node =3D fdt_next_node (Base, Prev, &Depth); > if (Node < 0) { >=20 Reviewed-by: Laszlo Ersek Thanks, Laszlo