[PATCH 26/34] efi: Simplify reading files by using the common function

Simon Glass sjg at chromium.org
Fri Oct 18 01:24:05 CEST 2024


The efiload_read_file() does similar things to a common function, so
update it to use that instead.

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

 boot/bootmeth_efi.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index 2ad6d3b4ace..f3ddbe71405 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -110,19 +110,14 @@ static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow)
 static int efiload_read_file(struct bootflow *bflow, ulong addr)
 {
 	struct blk_desc *desc = NULL;
-	loff_t bytes_read;
+	ulong size;
 	int ret;
 
 	if (bflow->blk)
 		 desc = dev_get_uclass_plat(bflow->blk);
-	ret = bootmeth_setup_fs(bflow, desc);
-	if (ret)
-		return log_msg_ret("set", ret);
 
-	ret = fs_read(bflow->fname, addr, 0, bflow->size, &bytes_read);
-	if (ret)
-		return log_msg_ret("read", ret);
-	bflow->buf = map_sysmem(addr, bflow->size);
+	ret = bootmeth_common_read_file(bflow->method, bflow, bflow->fname,
+					addr, &size);
 
 	set_efi_bootdev(desc, bflow);
 
-- 
2.34.1



More information about the U-Boot mailing list