]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/SmbiosVersionLib: 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:19 +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>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=166
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>
OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c

index 950c3f7e0a317213227d0832650c31c548df1cae..58180412bd1addc293a38bd08c844c192b3686f7 100644 (file)
@@ -40,6 +40,7 @@ DetectSmbiosVersion (
   UINTN                AnchorSize, TablesSize;\r
   QEMU_SMBIOS_ANCHOR   QemuAnchor;\r
   UINT16               SmbiosVersion;\r
+  RETURN_STATUS        PcdStatus;\r
 \r
   if (PcdGetBool (PcdQemuSmbiosValidated)) {\r
     //\r
@@ -87,7 +88,8 @@ DetectSmbiosVersion (
 \r
     DEBUG ((EFI_D_INFO, "%a: SMBIOS 3.x DocRev from QEMU: 0x%02x\n",\r
       __FUNCTION__, QemuAnchor.V3.DocRev));\r
-    PcdSet8 (PcdSmbiosDocRev, QemuAnchor.V3.DocRev);\r
+    PcdStatus = PcdSet8S (PcdSmbiosDocRev, QemuAnchor.V3.DocRev);\r
+    ASSERT_RETURN_ERROR (PcdStatus);\r
     break;\r
 \r
   default:\r
@@ -96,12 +98,14 @@ DetectSmbiosVersion (
 \r
   DEBUG ((EFI_D_INFO, "%a: SMBIOS version from QEMU: 0x%04x\n", __FUNCTION__,\r
     SmbiosVersion));\r
-  PcdSet16 (PcdSmbiosVersion, SmbiosVersion);\r
+  PcdStatus = PcdSet16S (PcdSmbiosVersion, SmbiosVersion);\r
+  ASSERT_RETURN_ERROR (PcdStatus);\r
 \r
   //\r
   // SMBIOS platform drivers can now fetch and install\r
   // "etc/smbios/smbios-tables" from QEMU.\r
   //\r
-  PcdSetBool (PcdQemuSmbiosValidated, TRUE);\r
+  PcdStatus = PcdSetBoolS (PcdQemuSmbiosValidated, TRUE);\r
+  ASSERT_RETURN_ERROR (PcdStatus);\r
   return RETURN_SUCCESS;\r
 }\r