public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8
@ 2016-09-05  7:56 Ard Biesheuvel
  2016-09-05 11:41 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2016-09-05  7:56 UTC (permalink / raw)
  To: edk2-devel, lersek; +Cc: Ard Biesheuvel

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 <ard.biesheuvel@linaro.org>
---
 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);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8
  2016-09-05  7:56 [PATCH] ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8 Ard Biesheuvel
@ 2016-09-05 11:41 ` Laszlo Ersek
  2016-09-05 11:44   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2016-09-05 11:41 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel

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 <ard.biesheuvel@linaro.org>
> ---
>  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 <lersek@redhat.com>

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8
  2016-09-05 11:41 ` Laszlo Ersek
@ 2016-09-05 11:44   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2016-09-05 11:44 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel@lists.01.org

On 5 September 2016 at 12:41, Laszlo Ersek <lersek@redhat.com> wrote:
> 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 <ard.biesheuvel@linaro.org>
>> ---
>>  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 <lersek@redhat.com>
>

Pushed, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-05 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-05  7:56 [PATCH] ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8 Ard Biesheuvel
2016-09-05 11:41 ` Laszlo Ersek
2016-09-05 11:44   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox