From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date: Fri, 19 Apr 2024 09:59:01 +0000 (+0200)
Subject: efi_loader: superfluous efi_restore_gd after EFI_CALL
X-Git-Tag: v2025.01-rc5-pxa1908~487^2~10
X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-logo.png?a=commitdiff_plain;h=a55039d6a847d8c83ea2175e09d3eed6d7d83571;p=u-boot.git

efi_loader: superfluous efi_restore_gd after EFI_CALL

EFI_CALL() invokes __efi_entry_check() which executes set_gd(efi_gd).
There is no need to execute set_gd(efi_gd) again via efi_restore_gd().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 578dbb19a7..c1454ffb94 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -107,7 +107,6 @@ static int do_efi_selftest(void)
 
 	/* Execute the test */
 	ret = EFI_CALL(efi_selftest(&image_obj->header, &systab));
-	efi_restore_gd();
 	free(loaded_image_info->load_options);
 	efi_free_pool(test_device_path);
 	efi_free_pool(test_image_path);
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index a587860e2a..d1f86e76e0 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1404,8 +1404,6 @@ static __maybe_unused int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
 	if (ret && exit_data)
 		efi_free_pool(exit_data);
 
-	efi_restore_gd();
-
 	free(load_options);
 	return CMD_RET_SUCCESS;
 }
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 6918fd5e48..9d7f82f452 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -544,8 +544,6 @@ efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
 		}
 	}
 
-	efi_restore_gd();
-
 out:
 	free(load_options);