From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 84DE01A1E2D for ; Mon, 5 Sep 2016 04:41:30 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E688674C; Mon, 5 Sep 2016 11:41:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-76.phx2.redhat.com [10.3.116.76]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u85BfS4O010494; Mon, 5 Sep 2016 07:41:29 -0400 To: Ard Biesheuvel , edk2-devel@ml01.01.org References: <1473062175-1567-1-git-send-email-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: Date: Mon, 5 Sep 2016 13:41:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1473062175-1567-1-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 05 Sep 2016 11:41:29 +0000 (UTC) Subject: Re: [PATCH] ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2016 11:41:30 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 09/05/16 09:56, Ard Biesheuvel wrote: > GCC 4.8 in RELEASE mode complains about GetPciIoTranslation () potentially > not assigning IoTranslation, but does not notice that it returns failure in > this case, which means IoTranslation is never referenced *unless* it has > been assigned. So simply set IoTranslation to zero to help the compiler. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c b/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c > index 10b47560cb9c..ea27cda7b77c 100644 > --- a/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c > +++ b/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c > @@ -128,6 +128,7 @@ FdtPciPcdProducerLibConstructor ( > > PcdSetBool (PcdPciDisableBusEnumeration, FALSE); > > + IoTranslation = 0; > RetStatus = GetPciIoTranslation (FdtClient, Node, &IoTranslation); > if (!RETURN_ERROR (RetStatus)) { > PcdSet64 (PcdPciIoTranslation, IoTranslation); > Ouch. This is exactly why "IoTranslation = 0" appeared at the beginning, in commit 65bb13b0fd7f ("ArmVirtualizationPkg/VirtFdtDxe: parse "pci-host-ecam-generic" properties"), and why we've been carrying it around, most recently in commit d4cb9a30494d ("ArmVirtPkg: implement FdtPciHostBridgeLib"). We forgot about it in commit c8f1a75aa997 ("ArmVirtPkg/FdtPciPcdProducerLib: add handling of PcdPciIoTranslation"). Reviewed-by: Laszlo Ersek Thanks Laszlo