[edk2-devel] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: skip over unsupported entries in StoreQemuBootOrder

Gerd Hoffmann kraxel at redhat.com
Wed Sep 21 05:30:45 UTC 2022


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 at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94041): https://edk2.groups.io/g/devel/message/94041
Mute This Topic: https://groups.io/mt/93820836/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list