public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Eric Jin" <eric.jin@intel.com>
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Liming Gao <liming.gao@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: [PATCH 12/14] FmpDevicePkg/FmpDxe: Change where FmpControllerState is updated
Date: Thu,  1 Aug 2019 16:47:35 +0800	[thread overview]
Message-ID: <20190801084735.10116-1-eric.jin@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525

In the 4 Setxxx() functions, do not update FmpControllerState
contents unless Update is TRUE.  This does not change any
behavior, but it does make the logic easier to understand.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
---
 FmpDevicePkg/FmpDxe/VariableSupport.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/FmpDevicePkg/FmpDxe/VariableSupport.c b/FmpDevicePkg/FmpDxe/VariableSupport.c
index 414a077ab2..a2deff94a5 100644
--- a/FmpDevicePkg/FmpDxe/VariableSupport.c
+++ b/FmpDevicePkg/FmpDxe/VariableSupport.c
@@ -498,11 +498,11 @@ SetVersionInVariable (
   if (FmpControllerState->Version != Version) {
     Update = TRUE;
   }
-  FmpControllerState->VersionValid = TRUE;
-  FmpControllerState->Version      = Version;
   if (!Update) {
     DEBUG ((DEBUG_INFO, "FmpDxe(%s): No need to update controller state.  Same value as before.\n", mImageIdName));
   } else {
+    FmpControllerState->VersionValid = TRUE;
+    FmpControllerState->Version      = Version;
     Status = gRT->SetVariable (
                     Private->FmpStateVariableName,
                     &gEfiCallerIdGuid,
@@ -561,11 +561,11 @@ SetLowestSupportedVersionInVariable (
   if (FmpControllerState->Lsv < LowestSupportedVersion) {
     Update = TRUE;
   }
-  FmpControllerState->LsvValid = TRUE;
-  FmpControllerState->Lsv      = LowestSupportedVersion;
   if (!Update) {
     DEBUG ((DEBUG_INFO, "FmpDxe(%s): No need to update controller state.  Same value as before.\n", mImageIdName));
   } else {
+    FmpControllerState->LsvValid = TRUE;
+    FmpControllerState->Lsv      = LowestSupportedVersion;
     Status = gRT->SetVariable (
                     Private->FmpStateVariableName,
                     &gEfiCallerIdGuid,
@@ -624,11 +624,11 @@ SetLastAttemptStatusInVariable (
   if (FmpControllerState->LastAttemptStatus != LastAttemptStatus) {
     Update = TRUE;
   }
-  FmpControllerState->LastAttemptStatusValid = TRUE;
-  FmpControllerState->LastAttemptStatus      = LastAttemptStatus;
   if (!Update) {
     DEBUG ((DEBUG_INFO, "FmpDxe(%s): No need to update controller state.  Same value as before.\n", mImageIdName));
   } else {
+    FmpControllerState->LastAttemptStatusValid = TRUE;
+    FmpControllerState->LastAttemptStatus      = LastAttemptStatus;
     Status = gRT->SetVariable (
                     Private->FmpStateVariableName,
                     &gEfiCallerIdGuid,
@@ -687,11 +687,11 @@ SetLastAttemptVersionInVariable (
   if (FmpControllerState->LastAttemptVersion != LastAttemptVersion) {
     Update = TRUE;
   }
-  FmpControllerState->LastAttemptVersionValid = TRUE;
-  FmpControllerState->LastAttemptVersion      = LastAttemptVersion;
   if (!Update) {
     DEBUG ((DEBUG_INFO, "FmpDxe(%s): No need to update controller state.  Same value as before.\n", mImageIdName));
   } else {
+    FmpControllerState->LastAttemptVersionValid = TRUE;
+    FmpControllerState->LastAttemptVersion      = LastAttemptVersion;
     Status = gRT->SetVariable (
                     Private->FmpStateVariableName,
                     &gEfiCallerIdGuid,
-- 
2.20.1.windows.1


                 reply	other threads:[~2019-08-01  8:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190801084735.10116-1-eric.jin@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox