From 12fded19f531a4711e36a19de1f1f5055c1be110 Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Sat, 18 Jan 2025 11:57:39 +0800 Subject: [PATCH] [DM/FDT] Fixup earlycon loss old messages. The `rt_fdt_scan_chosen_stdout` will init fdt_earlycon data without `msg` only, the `msg_idx` should not clean, too. Because we check if have old messages by `msg_idx` Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/ofw/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drivers/ofw/fdt.c b/components/drivers/ofw/fdt.c index cca4cdd20d..cfd6c32f23 100644 --- a/components/drivers/ofw/fdt.c +++ b/components/drivers/ofw/fdt.c @@ -593,7 +593,7 @@ rt_err_t rt_fdt_scan_chosen_stdout(void) int len, options_len = 0; const char *options = RT_NULL, *con_type = RT_NULL; - rt_memset(&fdt_earlycon, 0, sizeof(fdt_earlycon) - sizeof(fdt_earlycon.msg)); + rt_memset(&fdt_earlycon, 0, rt_offsetof(struct rt_fdt_earlycon, msg_idx)); fdt_earlycon.nodeoffset = -1; offset = fdt_path_offset(_fdt, "/chosen");