[Concept,06/14] efi: Use a local var for a handle with efidebug dh

Message ID 20250820144621.1073679-7-sjg@u-boot.org
State New
Headers
Series efi: app: Support booting an OS |

Commit Message

Simon Glass Aug. 20, 2025, 2:46 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Rather than repeating handles[i], put it in a variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/efidebug.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
  

Patch

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index d7f88692d8c..a6a0e877798 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -480,18 +480,24 @@  static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
 		return CMD_RET_SUCCESS;
 
 	for (i = 0; i < num; i++) {
+		/*
+		 * this cannot be dereferenced in the APP since the format is
+		 * defined by the underlying EFI implementation, which is likely
+		 * not U-Boot
+		 */
+		efi_handle_t handle = handles[i];
 		struct efi_handler *handler;
 
-		printf("\n%p", handles[i]);
-		if (handles[i]->dev)
-			printf(" (%s)", handles[i]->dev->name);
+		printf("\n%p", handle);
+		if (handle->dev)
+			printf(" (%s)", handle->dev->name);
 		printf("\n");
 		/* Print device path */
-		ret = efi_search_protocol(handles[i], &efi_guid_device_path,
+		ret = efi_search_protocol(handle, &efi_guid_device_path,
 					  &handler);
 		if (ret == EFI_SUCCESS)
 			printf("  %pD\n", handler->protocol_interface);
-		ret = efi_get_boot()->protocols_per_handle(handles[i], &guid,
+		ret = efi_get_boot()->protocols_per_handle(handle, &guid,
 							   &count);
 		/* Print other protocols */
 		for (j = 0; j < count; j++) {