[PATCH v2] spl: fit: Report fdt error for loading u-boot

Simon Glass sjg at chromium.org
Sun Jul 31 03:27:27 CEST 2022


Hi Bao Cheng,

On Sat, 30 Jul 2022 at 03:05, Su, Bao Cheng <baocheng.su at siemens.com> wrote:
>
> Commit 71551055cbdb ("spl: fit: Load devicetree when a Linux payload is
> found") made a change to not report the spl_fit_append_fdt error at all
> if next-stage image is u-boot.
>
> However for u-boot image without CONFIG_OF_EMBED, the error should be
> reported to uplevel caller. Otherwise, uplevel caller would think the
> fdt is already loaded which is obviously not true.
>
> Signed-off-by: Baocheng Su <baocheng.su at siemens.com>
> ---
>
> Changes in v2:
> - Fix the wrong wrapping
>
>  common/spl/spl_fit.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index a35be52965..00404935cb 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -770,8 +770,12 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>          */
>         if (os_takes_devicetree(spl_image->os)) {
>                 ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> -               if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> -                       return ret;
> +               if (ret < 0) {
> +                       if (spl_image->os != IH_OS_U_BOOT)
> +                               return ret;
> +                       else if (!IS_ENABLED(CONFIG_OF_EMBED))
> +                               return ret;

This is a pretty unpleasant condition. I think we would be better to
report the error and let the caller figure it out.

There are no tests associated with this, so it is hard to know what is
actually going on.

If we must have this workaround, I suggest adding a Kconfig so boards
that need it can turn it on, and other boards can use normal
operation, which is to report errors.

Regards,
Simon


More information about the U-Boot mailing list