[PATCH v6 01/11] bootstd: Tweak bootflow logic for device tree

Mark Kettenis mark.kettenis at xs4all.nl
Sun Apr 2 00:29:52 CEST 2023


> From: Simon Glass <sjg at chromium.org>
> Date: Sun,  2 Apr 2023 09:45:25 +1200
> 
> We should only store the FDT filename if we were unable to determine one.
> Adjust the logic for this.

This explanation makes no sense.  How can we store the FDT filename if
we were unable to determine one?

> This corrects the case where no FDT is needed to boot, such as with EFI
> using ACPI.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> (no changes since v5)
> 
> 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
> 
> 


More information about the U-Boot mailing list