[PATCH] dm: Fix OF_BAD_ADDR definition

Patrice Chotard patrice.chotard at foss.st.com
Thu Dec 23 17:09:32 CET 2021


When OF_LIVE flag is enabled on a 64 bits platform, there is an
issue when dev_read_addr() is called and need to perform an address
translation using __of_translate_address().

In case of error, __of_translate_address() return value is OF_BAD_ADDR
(wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff).
The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE
which is defined as (-1U) = 0xffffffff.
In this case the comparison is always false.

To fix this issue, define OF_BAD_ADDR to FDT_ADDR_T_NONE.

Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
---

 include/dm/of.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/dm/of.h b/include/dm/of.h
index 5cb6f44a6c..0208cc234a 100644
--- a/include/dm/of.h
+++ b/include/dm/of.h
@@ -95,7 +95,7 @@ static inline bool of_live_active(void)
 	return gd_of_root() != NULL;
 }
 
-#define OF_BAD_ADDR	((u64)-1)
+#define OF_BAD_ADDR	FDT_ADDR_T_NONE
 
 static inline const char *of_node_full_name(const struct device_node *np)
 {
-- 
2.17.1



More information about the U-Boot mailing list