Skip to contentSkip to conversation

do not pass NULL pointer to libfdt

PATCH New Stanislav Pinchuk 2 participants 2 messages Jan 20, 2021 – Jan 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 do not pass NULL pointer to libfdt

Re-send because of line-wraps.

Without this patch, u-boot just hangs if the fdt pointer is not initialized. The diagnostic subsystems are not yet initialized, so all you get is a blind hang.

Signed-off-by Stanislav.Pinchuk at kaspersky.com
---
 include/dm/read.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/dm/read.h +1 -1
index c875e11a13..d3fd27da8a 100644
@@ -1007,7 +1007,7 @@ static inline u64 dev_translate_dma_address(const struct udevice *dev,
 
 static inline int dev_read_alias_highest_id(const char *stem)
 {
-       if (!CONFIG_IS_ENABLED(OF_LIBFDT))
+       if (!CONFIG_IS_ENABLED(OF_LIBFDT) || !gd->fdt_blob)
                return -1;
        return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
 }

--
2.25.1

#1 lore raw

PATCH 1/1 do not pass NULL pointer to libfdt

Re-send because of line-wraps.

Without this patch, u-boot just hangs if the fdt pointer is not initialized. The diagnostic subsystems are not yet initialized, so all you get is a blind hang.

Signed-off-by Stanislav.Pinchuk at kaspersky.com
---
 include/dm/read.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm, thanks!