[PATCH] lib: fdt_helper: Removed unnecessary dt parsing check
Anup Patel
anup at brainfault.org
Mon Mar 9 01:59:11 PDT 2026
On Thu, Feb 19, 2026 at 2:04 PM Victoriano Morales | OPENCHIP
<victoriano.morales at openchip.com> wrote:
>
> From: Victoriano Morales <victoriano.morales at openchip.com>
>
> The check for the address being different from 0 for the UART, PLIC,
> APLIC and IMSIC dt nodes is unnnecessary and could skip valid nodes.
>
> Signed-off-by: Victoriano Morales <victoriano.morales at openchip.com>
LGTM.
Reviewed-by: Anup Patel <anup at brainfault.org>
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
> ---
> lib/utils/fdt/fdt_helper.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c
> index 799fd48d..a8c6e1aa 100644
> --- a/lib/utils/fdt/fdt_helper.c
> +++ b/lib/utils/fdt/fdt_helper.c
> @@ -502,7 +502,7 @@ static int fdt_parse_uart_node_common(const void *fdt, int nodeoffset,
>
> rc = fdt_get_node_addr_size(fdt, nodeoffset, 0,
> ®_addr, ®_size);
> - if (rc < 0 || !reg_addr || !reg_size)
> + if (rc < 0 || !reg_size)
> return SBI_ENODEV;
> uart->addr = reg_addr;
>
> @@ -671,7 +671,7 @@ int fdt_parse_aplic_node(const void *fdt, int nodeoff, struct aplic_data *aplic)
> return SBI_ENODEV;
>
> rc = fdt_get_node_addr_size(fdt, nodeoff, 0, ®_addr, ®_size);
> - if (rc < 0 || !reg_addr || !reg_size)
> + if (rc < 0 || !reg_size)
> return SBI_ENODEV;
> aplic->addr = reg_addr;
> aplic->size = reg_size;
> @@ -863,7 +863,7 @@ int fdt_parse_imsic_node(const void *fdt, int nodeoff, struct imsic_data *imsic)
>
> rc = fdt_get_node_addr_size(fdt, nodeoff, i,
> ®_addr, ®_size);
> - if (rc < 0 || !reg_addr || !reg_size)
> + if (rc < 0 || !reg_size)
> break;
> regs->addr = reg_addr;
> regs->size = reg_size;
> @@ -885,7 +885,7 @@ int fdt_parse_plic_node(const void *fdt, int nodeoffset, struct plic_data *plic)
>
> rc = fdt_get_node_addr_size(fdt, nodeoffset, 0,
> ®_addr, ®_size);
> - if (rc < 0 || !reg_addr || !reg_size)
> + if (rc < 0 || !reg_size)
> return SBI_ENODEV;
> plic->addr = reg_addr;
> plic->size = reg_size;
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list