diff options
author | Luigi Leonardi <leonardi@redhat.com> | 2024-12-13 11:35:34 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-23 10:36:19 +0000 |
commit | 597342b2120f819aa1ba063dd10143a5f420a251 (patch) | |
tree | 379874dfd128f976dc774aee37599801fe76aa13 | |
parent | abbd05992d39eb48a76d08f2f3b750c557e0ce28 (diff) | |
download | edk2-597342b2120f819aa1ba063dd10143a5f420a251.tar.gz |
OvmfPkg/PlatformBootManagerLib: Optimize PlatformRegisterFvBootOption
Add a FileIsInFv check to PlatformRegisterFvBootOption, this is to
to avoid adding and then removing a boot option shortly after,
because the file is no longer in the firmware volume.
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
-rw-r--r-- | OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c index 430da6429d..17e3bda967 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -199,6 +199,15 @@ PlatformRegisterFvBootOption ( );
ASSERT (DevicePath != NULL);
+ //
+ // File is not in firmware, so it is going to be deleted anyway by
+ // RemoveStaleFvFileOptions, let's not add it.
+ //
+ if (!FileIsInFv (DevicePath)) {
+ FreePool (DevicePath);
+ return;
+ }
+
Status = EfiBootManagerInitializeLoadOption (
&NewOption,
LoadOptionNumberUnassigned,
|