From 70089c13a73f58315547982573be2016e7a70958 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Sun, 16 Oct 2022 11:36:32 +0300 Subject: efi_loader: remove efi_delete_handle on loadfile2 Loadfile2 code is installing two protocols on it's own handle and uses efi_delete_handle() to clean it up on failure(s). However commit 05c4c9e21ae6 ("efi_loader: define internal implementations of install/uninstallmultiple") prepares the ground for us to clean up efi_delete_handle() used in favor of Install/UninstallMultipleProtocol. While at it clean up the non needed void casts to (void *) on the protolcol installation. Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_load_initrd.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c index 87fde3f..1934337 100644 --- a/lib/efi_loader/efi_load_initrd.c +++ b/lib/efi_loader/efi_load_initrd.c @@ -213,7 +213,7 @@ efi_status_t efi_initrd_register(void) &efi_guid_device_path, &dp_lf2_handle, /* LOAD_FILE2 */ &efi_guid_load_file2_protocol, - (void *)&efi_lf2_protocol, + &efi_lf2_protocol, NULL); return ret; @@ -227,11 +227,22 @@ efi_status_t efi_initrd_register(void) * * Return: status code */ -void efi_initrd_deregister(void) +efi_status_t efi_initrd_deregister(void) { + efi_status_t ret; + if (!efi_initrd_handle) - return; + return EFI_SUCCESS; - efi_delete_handle(efi_initrd_handle); + ret = efi_uninstall_multiple_protocol_interfaces(efi_initrd_handle, + /* initramfs */ + &efi_guid_device_path, + &dp_lf2_handle, + /* LOAD_FILE2 */ + &efi_guid_load_file2_protocol, + &efi_lf2_protocol, + NULL); efi_initrd_handle = NULL; + + return ret; } -- cgit v1.1