[v2,4/4] common: Allow relocations on the top of the last bank

Simon Glass sjg at chromium.org
Wed Apr 1 21:59:18 CEST 2026


Hi Ilias,

On 2026-03-31T08:01:10, Ilias Apalodimas <ilias.apalodimas at linaro.org> wrote:
> diff --git a/common/board_f.c b/common/board_f.c
> @@ -321,6 +323,19 @@ __weak phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
> +     if (IS_ENABLED(CONFIG_RELOCATE_LAST_BANK)) {
> +             phys_addr_t old_top = gd->ram_top;
> +
> +             ret = fdtdec_setup_mem_ram_top();
> +             if (ret)
> +                     debug("failed to relocate to ram top");
> +             ret = fdtdec_setup_ram_size();

If fdtdec_setup_mem_ram_top() fails it will restore gd->ram_top to its
original value and return an error, but then fdtdec_setup_ram_size()
is still called. That will recalculate gd->ram_size even though the
ram_top hasn't changed, which seems inconsistent. I think the two
functions should both succeed or both fail.

Regards,
Simon


More information about the U-Boot mailing list