public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Oliver Steffen <osteffen@redhat.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Jiewen Yao <jiewen.yao@intel.com>
Subject: [PATCH 2/2] OvmfPkg/QemuBootOrderLib: skip over unsupported entries in StoreQemuBootOrder
Date: Wed, 21 Sep 2022 07:30:45 +0200	[thread overview]
Message-ID: <20220921053045.92473-3-kraxel@redhat.com> (raw)
In-Reply-To: <20220921053045.92473-1-kraxel@redhat.com>

When finding an unsupported entry just skip over and continue
with the next entry instead of stop processing altogether.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../QemuBootOrderLib/QemuBootOrderLib.c       | 56 ++++++++++---------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index 374c6d8f5e91..18646daa67e3 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -1775,35 +1775,39 @@ StoreQemuBootOrder (
                      Translated,
                      &TranslatedSize
                      );
-  while (!RETURN_ERROR (Status)) {
-    EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+  while (Status == EFI_SUCCESS ||
+         Status == EFI_UNSUPPORTED)
+  {
+    if (Status == EFI_SUCCESS) {
+      EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
 
-    //
-    // Convert the UEFI devpath prefix to binary representation.
-    //
-    ASSERT (Translated[TranslatedSize] == L'\0');
-    DevicePath = ConvertTextToDevicePath (Translated);
-    if (DevicePath == NULL) {
-      Status = RETURN_OUT_OF_RESOURCES;
-      goto FreeExtraPciRoots;
+      //
+      // Convert the UEFI devpath prefix to binary representation.
+      //
+      ASSERT (Translated[TranslatedSize] == L'\0');
+      DevicePath = ConvertTextToDevicePath (Translated);
+      if (DevicePath == NULL) {
+        Status = RETURN_OUT_OF_RESOURCES;
+        goto FreeExtraPciRoots;
+      }
+
+      UnicodeSPrint (
+        VariableName,
+        sizeof (VariableName),
+        L"QemuBootOrder%04d",
+        VariableIndex++
+        );
+      DEBUG ((DEBUG_INFO, "%a: %s = %s\n", __FUNCTION__, VariableName, Translated));
+      gRT->SetVariable (
+             VariableName,
+             &gQemuBootOrderGuid,
+             EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+             GetDevicePathSize (DevicePath),
+             DevicePath
+             );
+      FreePool (DevicePath);
     }
 
-    UnicodeSPrint (
-      VariableName,
-      sizeof (VariableName),
-      L"QemuBootOrder%04d",
-      VariableIndex++
-      );
-    DEBUG ((DEBUG_INFO, "%a: %s = %s\n", __FUNCTION__, VariableName, Translated));
-    gRT->SetVariable (
-           VariableName,
-           &gQemuBootOrderGuid,
-           EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
-           GetDevicePathSize (DevicePath),
-           DevicePath
-           );
-    FreePool (DevicePath);
-
     //
     // Move to the next OFW devpath.
     //
-- 
2.37.3


  parent reply	other threads:[~2022-09-21  5:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  5:30 [PATCH 0/2] OvmfPkg/QemuBootOrderLib: StoreQemuBootOrder bugfix Gerd Hoffmann
2022-09-21  5:30 ` [PATCH 1/2] OvmfPkg/QemuBootOrderLib: allow slash in rom filenames Gerd Hoffmann
2022-09-21  5:30 ` Gerd Hoffmann [this message]
2022-09-28 10:49 ` [PATCH 0/2] OvmfPkg/QemuBootOrderLib: StoreQemuBootOrder bugfix Ard Biesheuvel

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=20220921053045.92473-3-kraxel@redhat.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