[PATCH 1/3] riscv: Do not return error if reserved node already exists

Bin Meng bmeng.cn at gmail.com
Tue Jun 23 09:24:32 CEST 2020


Hi Atish,

On Fri, Jun 19, 2020 at 9:52 AM Atish Patra <atish.patra at wdc.com> wrote:
>
> Not all errors are fatal. If a reserved memory node already exists in the
> destination device tree, we can continue to boot without failing.
>
> Signed-off-by: Atish Patra <atish.patra at wdc.com>
> ---
>  arch/riscv/lib/fdt_fixup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
> index 6db48ad04a56..91524d9a5ae9 100644
> --- a/arch/riscv/lib/fdt_fixup.c
> +++ b/arch/riscv/lib/fdt_fixup.c
> @@ -62,7 +62,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>                 pmp_mem.end = addr + size - 1;
>                 err = fdtdec_add_reserved_memory(dst, basename, &pmp_mem,
>                                                  &phandle);
> -               if (err < 0) {
> +               if (err < 0 && err != FDT_ERR_EXISTS) {

This FDT_ERR_EXISTS error code is possibly returned by:

    node = fdt_add_subnode(blob, parent, name);
    if (node < 0)
        return node;

But if it exists, I believe fdtdec_add_reserved_memory() already
returns 0 because they are likely to have the same range of memory
block start address and size, no?

>                         printf("failed to add reserved memory: %d\n", err);
>                         return err;
>                 }
> --

Regards,
Bin


More information about the U-Boot mailing list