[PATCH 1/4] include: sbi_utils: fixup fdt_get_address
Xiang W
wxjstz at 126.com
Thu Jun 6 02:17:13 PDT 2024
root.next_arg1 will be NULL before sbi_domain_init, which will cause
fdt address to be NULL before sbi_domain is initialized. This patch
fixes this.
Signed-off-by: Xiang W <wxjstz at 126.com>
---
include/sbi_utils/fdt/fdt_helper.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/sbi_utils/fdt/fdt_helper.h b/include/sbi_utils/fdt/fdt_helper.h
index ab4a80f..67e6dc7 100644
--- a/include/sbi_utils/fdt/fdt_helper.h
+++ b/include/sbi_utils/fdt/fdt_helper.h
@@ -116,7 +116,9 @@ int fdt_parse_compat_addr(void *fdt, uint64_t *addr,
static inline void *fdt_get_address(void)
{
- return (void *)root.next_arg1;
+ if (root.next_arg1)
+ return (void *)root.next_arg1;
+ return sbi_scratch_thishart_arg1_ptr();
}
#endif /* __FDT_HELPER_H__ */
--
2.43.0
More information about the opensbi
mailing list