public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v5 1/8] bootstd: Tweak bootflow logic for device tree
@ 2023-03-30 21:25 Simon Glass
  2023-03-30 21:25 ` [PATCH v5 2/8] virtio: Ensure PCI is set up first Simon Glass
                   ` (6 more replies)
  0 siblings, 7 replies; 27+ messages in thread
From: Simon Glass @ 2023-03-30 21:25 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Vagrant Cascadian, huang lin, Jeffy Chen, Simon Glass,
	Kever Yang, Philipp Tomsich

We should only store the FDT filename if we were unable to determine one.
Adjust the logic for this.

This corrects the case where no FDT is needed to boot, such as with EFI
using ACPI.

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

Changes in v5:
- Add new patch to tweak bootflow logic for device tree

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

diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index 6a97ac02ff5c..d7e042cf01ee 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -235,21 +235,21 @@ static int distro_efi_read_bootflow_file(struct udevice *dev,
 
 	/* try the various available names */
 	ret = -ENOENT;
-	for (seq = 0; ret; seq++) {
+	*fname = '\0';
+	for (seq = 0; ret == -ENOENT; seq++) {
 		ret = distro_efi_get_fdt_name(fname, sizeof(fname), seq);
-		if (ret == -EALREADY) {
+		if (ret == -EALREADY)
 			bflow->flags = BOOTFLOWF_USE_PRIOR_FDT;
-			break;
-		}
-		if (ret)
-			return log_msg_ret("nam", ret);
-		ret = bootmeth_common_read_file(dev, bflow, fname, fdt_addr,
-						&size);
+		if (!ret)
+			ret = bootmeth_common_read_file(dev, bflow, fname,
+							fdt_addr, &size);
 	}
 
-	bflow->fdt_fname = strdup(fname);
-	if (!bflow->fdt_fname)
-		return log_msg_ret("fil", -ENOMEM);
+	if (*fname) {
+		bflow->fdt_fname = strdup(fname);
+		if (!bflow->fdt_fname)
+			return log_msg_ret("fil", -ENOMEM);
+	}
 
 	if (!ret) {
 		bflow->fdt_size = size;
-- 
2.40.0.348.gf938b09366-goog


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-04-07 19:57 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30 21:25 [PATCH v5 1/8] bootstd: Tweak bootflow logic for device tree Simon Glass
2023-03-30 21:25 ` [PATCH v5 2/8] virtio: Ensure PCI is set up first Simon Glass
2023-03-30 21:25 ` [PATCH v5 3/8] bootstd: Support booting EFI where multiple options exist Simon Glass
2023-03-31 18:02   ` Tom Rini
2023-04-01  6:31     ` Simon Glass
2023-04-03  9:56       ` Ilias Apalodimas
2023-04-03 14:17         ` Tom Rini
2023-04-03 16:26           ` Heinrich Schuchardt
2023-04-04  6:09             ` Ilias Apalodimas
2023-04-05  5:28           ` Simon Glass
2023-04-05 14:47             ` Tom Rini
2023-04-05 21:56               ` Mark Kettenis
2023-04-06  5:42                 ` Heinrich Schuchardt
2023-04-07 19:38                 ` Tom Rini
2023-04-07 18:55               ` Simon Glass
2023-04-07 19:39                 ` Tom Rini
2023-04-07 19:44                   ` Ilias Apalodimas
2023-04-07 19:56                     ` Simon Glass
2023-04-07 19:57                     ` Tom Rini
2023-03-30 21:25 ` [PATCH v5 4/8] rockchip: Move to standard boot Simon Glass
2023-03-30 21:25 ` [PATCH v5 5/8] rockchip: Use the same boot_targets for all boards Simon Glass
2023-03-30 21:25 ` [PATCH v5 6/8] bootstd: Show a message sometimes if no bootflows are found Simon Glass
2023-03-30 21:26 ` [PATCH v5 7/8] bootstd: Report missing labels only when asked Simon Glass
2023-03-30 21:26 ` [PATCH v5 8/8] bootstd: Enable BOOTSTD_DEFAULTS by default Simon Glass
2023-03-31 18:00   ` Tom Rini
2023-04-01  6:31     ` Simon Glass
2023-04-03 14:33       ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox