]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/FdtPciPcdProducerLib: eliminate unchecked PcdSetXX() calls
authorLaszlo Ersek <lersek@redhat.com>
Fri, 21 Oct 2016 09:59:36 +0000 (11:59 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Tue, 25 Oct 2016 08:46:36 +0000 (10:46 +0200)
These are deprecated / disabled under the
DISABLE_NEW_DEPRECATED_INTERFACES feature test macro.

Introduce a variable called PcdStatus, and use it to assert the success of
these operations (there is no reason for them to fail here).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # RVCT
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c

index ea27cda7b77cf7a4fd6e02e3084f6a2cbfc6c9a6..072f54ef7d9e81fe2fbb01b67099cf7333d96f21 100644 (file)
@@ -98,6 +98,7 @@ FdtPciPcdProducerLibConstructor (
   INT32               Node;\r
   RETURN_STATUS       RetStatus;\r
   UINT64              IoTranslation;\r
+  RETURN_STATUS       PcdStatus;\r
 \r
   PciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress);\r
   if (PciExpressBaseAddress != MAX_UINT64) {\r
@@ -126,12 +127,14 @@ FdtPciPcdProducerLibConstructor (
     if (!EFI_ERROR (Status) && RegSize == 2 * sizeof (UINT64)) {\r
       PciExpressBaseAddress = SwapBytes64 (*Reg);\r
 \r
-      PcdSetBool (PcdPciDisableBusEnumeration, FALSE);\r
+      PcdStatus = PcdSetBoolS (PcdPciDisableBusEnumeration, FALSE);\r
+      ASSERT_RETURN_ERROR (PcdStatus);\r
 \r
       IoTranslation = 0;\r
       RetStatus = GetPciIoTranslation (FdtClient, Node, &IoTranslation);\r
       if (!RETURN_ERROR (RetStatus)) {\r
-          PcdSet64 (PcdPciIoTranslation, IoTranslation);\r
+          PcdStatus = PcdSet64S (PcdPciIoTranslation, IoTranslation);\r
+          ASSERT_RETURN_ERROR (PcdStatus);\r
       } else {\r
         //\r
         // Support for I/O BARs is not mandatory, and so it does not make sense\r
@@ -145,7 +148,8 @@ FdtPciPcdProducerLibConstructor (
     }\r
   }\r
 \r
-  PcdSet64 (PcdPciExpressBaseAddress, PciExpressBaseAddress);\r
+  PcdStatus = PcdSet64S (PcdPciExpressBaseAddress, PciExpressBaseAddress);\r
+  ASSERT_RETURN_ERROR (PcdStatus);\r
 \r
   return RETURN_SUCCESS;\r
 }\r