]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 27 Jun 2019 07:39:57 +0000 (16:39 +0900)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Jul 2019 19:54:08 +0000 (12:54 -0700)
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>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
common/fdt_support.c

index a23367b54a497df065f1bfad63f484d978163930..699d4a2d0eaf2f176cbf9626f223435363e8f8b1 100644 (file)
@@ -1552,7 +1552,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;
 }
 
 /*