summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_init.c
diff options
context:
space:
mode:
authorMichael Brown2025-03-23 20:11:13 +0100
committerMichael Brown2025-03-24 14:19:26 +0100
commitbac318743905e55ce424104cafbc8418e0672a80 (patch)
tree43707838ec1b471314ff426f50b434ff2cca031c /src/interface/efi/efi_init.c
parent[efi] Use efi_open_unsafe() for all explicitly unsafe protocol opens (diff)
downloadipxe-bac318743905e55ce424104cafbc8418e0672a80.tar.gz
ipxe-bac318743905e55ce424104cafbc8418e0672a80.tar.xz
ipxe-bac318743905e55ce424104cafbc8418e0672a80.zip
[efi] Use efi_open() for all ephemeral protocol opens
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_init.c')
-rw-r--r--src/interface/efi/efi_init.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/interface/efi/efi_init.c b/src/interface/efi/efi_init.c
index a45ee66a4..03506ec5c 100644
--- a/src/interface/efi/efi_init.c
+++ b/src/interface/efi/efi_init.c
@@ -263,13 +263,12 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
efi_cmdline_len = efi_loaded_image->LoadOptionsSize;
/* Get loaded image's device handle's device path */
- if ( ( efirc = bs->OpenProtocol ( efi_loaded_image->DeviceHandle,
- &efi_device_path_protocol_guid,
- &device_path, image_handle, NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) {
- rc = -EEFI ( efirc );
+ if ( ( rc = efi_open ( efi_loaded_image->DeviceHandle,
+ &efi_device_path_protocol_guid,
+ &device_path ) ) != 0 ) {
DBGC ( systab, "EFI could not get loaded image's device path: "
"%s", strerror ( rc ) );
+ efirc = EFIRC ( rc );
goto err_no_device_path;
}