diff mbox

[edk2,09/19] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: eliminate unchecked PcdSetXX() calls

Message ID 20161021212737.15974-10-lersek@redhat.com
State Accepted
Commit 65157adef2c079b30a21740f365f8e26b5481b6c
Headers show

Commit Message

Laszlo Ersek Oct. 21, 2016, 9:27 p.m. UTC
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: 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>

---
 OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

-- 
2.9.2


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
index c37aed1c9e7b..ff27c1100c01 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
@@ -965,6 +965,7 @@  FvbInitialize (
   EFI_PHYSICAL_ADDRESS                BaseAddress;
   UINTN                               Length;
   UINTN                               NumOfBlocks;
+  RETURN_STATUS                       PcdStatus;
 
   if (EFI_ERROR (QemuFlashInitialize ())) {
     //
@@ -1095,18 +1096,21 @@  FvbInitialize (
   //
   // Set several PCD values to point to flash
   //
-  PcdSet64 (
+  PcdStatus = PcdSet64S (
     PcdFlashNvStorageVariableBase64,
     (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase)
     );
-  PcdSet32 (
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet32S (
     PcdFlashNvStorageFtwWorkingBase,
     PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase)
     );
-  PcdSet32 (
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet32S (
     PcdFlashNvStorageFtwSpareBase,
     PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase)
     );
+  ASSERT_RETURN_ERROR (PcdStatus);
 
   FwhInstance = (EFI_FW_VOL_INSTANCE *)
     (
@@ -1119,6 +1123,7 @@  FvbInitialize (
   //
   InstallVirtualAddressChangeHandler ();
 
-  PcdSetBool (PcdOvmfFlashVariablesEnable, TRUE);
+  PcdStatus = PcdSetBoolS (PcdOvmfFlashVariablesEnable, TRUE);
+  ASSERT_RETURN_ERROR (PcdStatus);
   return EFI_SUCCESS;
 }