From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.groups.io with SMTP id smtpd.web11.32709.1585210289293658942 for ; Thu, 26 Mar 2020 01:11:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=JMj74i4w; spf=pass (domain: linaro.org, ip: 209.85.128.65, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f65.google.com with SMTP id z18so5454155wmk.2 for ; Thu, 26 Mar 2020 01:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=2KqaQLE+CFCxDHMifEknTr7vI37vBHkAd8Ye+6QKxLw=; b=JMj74i4w5C80bL7n7Y1SgpLcuU9PbQLGZLG2QRldaj7cw0GGoUk7s9dst4xHhrmMAG pBsQpDIzmhU3OKZz2qgHEtZZ8TT/xj/dwEjp/pqs5pDvWhJl8SmqbmM5y8j/1biU/4mU UfMnT8xj5ap9r1Fyg+xeRjEcOmhgGKdMyWqwvOIRYqp2sGXj/vGH9fF7EukpiGqFsc0E 3cwmtSwjGFz4WfYIYtzseF7MP0RlGX8DmbjmoyC4J3uxsLDUs+6fPdonM/S1ZL98kZWD VWI9CbU/SuihF7Ed0DhTtb4zlFdqdrbNyVrZADkT8XKHfDrWZuHmVCqJgi9zubcUJ8Uk cw3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=2KqaQLE+CFCxDHMifEknTr7vI37vBHkAd8Ye+6QKxLw=; b=ZrXxZSK3azCZZBiIm1mtSx6Drzg3596Y8o2AAOIbcIYjst9KoBZDFaj5BVp4o+7o0L sVhp5Ik42pot1pbSOsFRQeTyOwEW9mNY/zIfDEXtJDzgPhWvuJmxl44It1Kq/D7+h1vk /QEh1Sjj2O9yGlOlhlUpZLc91PrMalKxRzagd022687C4tAgsX3A1u5HfW3tafjwgSLW N+IctX8oMOlBhQjMtuYzBX2wMLS5sBs7iHuAqZXdGZPJovwvgEwlxIpkOQ35yjYXBknR MtacqLoe//d2OpX8/2gys1PNsoB7ApTC8tQutVsJIIQgM5AHpUv2iXkD0Lcb9Ivwib9V B1ig== X-Gm-Message-State: ANhLgQ3g4FbxjnUiu92IzJSokjZC0yZ4bJBqfs4f4WIw4JU7KMGY+CXu XJMSZJ4FKw4wxLPna5jthRuhbk91cHXTDqBctuLM5g== X-Google-Smtp-Source: ADFU+vvVS8co2JiItHMsai3QMgUkjD1pFMfHIruMr5J4Ljy68HAega+vfc4MHlYgawibcG2b+VBjbCgjPTrd5qqEOpY= X-Received: by 2002:a1c:6285:: with SMTP id w127mr1896740wmb.133.1585210287894; Thu, 26 Mar 2020 01:11:27 -0700 (PDT) MIME-Version: 1.0 References: <20200325093334.24793-1-ard.biesheuvel@linaro.org> <49216154-35d3-b03e-7f2b-b2280d39c3fe@redhat.com> In-Reply-To: <49216154-35d3-b03e-7f2b-b2280d39c3fe@redhat.com> From: "Ard Biesheuvel" Date: Thu, 26 Mar 2020 09:11:16 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH] ArmVirtPkg/PlatformPeiLib: add dummy assignment to work around older GCC To: Laszlo Ersek Cc: edk2-devel-groups-io Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 25 Mar 2020 at 20:11, Laszlo Ersek wrote: > > 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 > > > > /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= :24: > > error: =E2=80=98Parent=E2=80=99 may be used uninitialized in this= function > > [-Werror=3Dmaybe-uninit= ialized] > > RangesProp =3D fdt_getprop (Base, Parent, "ranges", &Range= sLen); > > > > Set Parent to 0 at the start of the sequence to work around this. > > > > Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2601 > > Fixes: 82662a3b5f56e974 ("ArmVirtPkg/PlatformPeiLib: discover the TPM b= ase ...") > > Signed-off-by: Ard Biesheuvel > > --- > > ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVi= rtPkg/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 ( > > > > TpmBase =3D 0; > > > > + // > > + // 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) { > > > > Reviewed-by: Laszlo Ersek > Pushed, thanks.