diff mbox

[edk2,16/19] ArmVirtPkg/PlatformBootManagerLib: eliminate unchecked PcdSetXX() calls

Message ID 20161021212737.15974-17-lersek@redhat.com
State Accepted
Commit 2ea0fee9c77556d2cd8f898500c2240dd41e8a40
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: 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>

---
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.9.2


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

Comments

Ard Biesheuvel Oct. 24, 2016, 7:58 a.m. UTC | #1
On 21 October 2016 at 22:27, Laszlo Ersek <lersek@redhat.com> wrote:
> 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>


> ---

>  ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 6 +++++-

>  1 file changed, 5 insertions(+), 1 deletion(-)

>

> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

> index aecad570a04f..56f4c921b513 100644

> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c

> @@ -578,6 +578,8 @@ PlatformBootManagerBeforeConsole (

>    VOID

>    )

>  {

> +  RETURN_STATUS PcdStatus;

> +

>    //

>    // Signal EndOfDxe PI Event

>    //

> @@ -629,7 +631,9 @@ PlatformBootManagerBeforeConsole (

>    //

>    // Set the front page timeout from the QEMU configuration.

>    //

> -  PcdSet16 (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ());

> +  PcdStatus = PcdSet16S (PcdPlatformBootTimeOut,

> +                GetFrontPageTimeoutFromQemu ());

> +  ASSERT_RETURN_ERROR (PcdStatus);

>

>    //

>    // Register platform-specific boot options and keyboard shortcuts.

> --

> 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/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index aecad570a04f..56f4c921b513 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -578,6 +578,8 @@  PlatformBootManagerBeforeConsole (
   VOID
   )
 {
+  RETURN_STATUS PcdStatus;
+
   //
   // Signal EndOfDxe PI Event
   //
@@ -629,7 +631,9 @@  PlatformBootManagerBeforeConsole (
   //
   // Set the front page timeout from the QEMU configuration.
   //
-  PcdSet16 (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ());
+  PcdStatus = PcdSet16S (PcdPlatformBootTimeOut,
+                GetFrontPageTimeoutFromQemu ());
+  ASSERT_RETURN_ERROR (PcdStatus);
 
   //
   // Register platform-specific boot options and keyboard shortcuts.