diff mbox series

[U-Boot] fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found

Message ID 20190627073957.19968-1-yamada.masahiro@socionext.com
State Accepted
Commit e3665ba9d7c82f75c4dbd2057276a6990929be40
Delegated to: Simon Glass
Headers show
Series [U-Boot] fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found | expand

Commit Message

Masahiro Yamada June 27, 2019, 7:39 a.m. UTC
Currently, fdt_get_base_address() returns 0 if the "reg" property is
missing. Since 0 is a valid value, it is not suitable for the error
handling. Return OF_BAD_ADDR instead.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 common/fdt_support.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bin Meng June 27, 2019, 8:07 a.m. UTC | #1
On Thu, Jun 27, 2019 at 3:40 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Currently, fdt_get_base_address() returns 0 if the "reg" property is
> missing. Since 0 is a valid value, it is not suitable for the error
> handling. Return OF_BAD_ADDR instead.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  common/fdt_support.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass July 21, 2019, 1:50 a.m. UTC | #2
On Thu, Jun 27, 2019 at 3:40 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Currently, fdt_get_base_address() returns 0 if the "reg" property is
> missing. Since 0 is a valid value, it is not suitable for the error
> handling. Return OF_BAD_ADDR instead.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  common/fdt_support.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/common/fdt_support.c b/common/fdt_support.c
index f31e9b0cc5a8..61c7b2096fbb 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1546,7 +1546,7 @@  u64 fdt_get_base_address(const void *fdt, int node)
 
 	prop = fdt_getprop(fdt, node, "reg", &size);
 
-	return prop ? fdt_translate_address(fdt, node, prop) : 0;
+	return prop ? fdt_translate_address(fdt, node, prop) : OF_BAD_ADDR;
 }
 
 /*