From 3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 3 Aug 2020 22:17:35 +0300 Subject: dm: core: Fix devfdt_get_addr_ptr return value According to the description of devfdt_get_addr_ptr, this function should return NULL on failure, but currently it returns (void *)FDT_ADDR_T_NONE. Fix this by making devfdt_get_addr_ptr return NULL on failure, as described in the function comments. Also, update the drivers currently checking (void *)FDT_ADDR_T_NONE to check for NULL. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- include/dm/read.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/dm/read.h') diff --git a/include/dm/read.h b/include/dm/read.h index cac7dd5f18..0a7aacd2d0 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -802,9 +802,7 @@ static inline fdt_addr_t dev_read_addr(const struct udevice *dev) static inline void *dev_read_addr_ptr(const struct udevice *dev) { - void *addr = devfdt_get_addr_ptr(dev); - - return ((fdt_addr_t)(uintptr_t)addr == FDT_ADDR_T_NONE) ? NULL : addr; + return devfdt_get_addr_ptr(dev); } static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev) -- cgit