From: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Thu, 27 Jun 2019 07:39:57 +0000 (+0900)
Subject: fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found
X-Git-Tag: v2025.01-rc5-pxa1908~2870^2~9
X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-logo.png?a=commitdiff_plain;h=e3665ba9d7c82f75c4dbd2057276a6990929be40;p=u-boot.git

fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found

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>
---

diff --git a/common/fdt_support.c b/common/fdt_support.c
index a23367b54a..699d4a2d0e 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -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;
 }
 
 /*