Skip to content

Commit bdf5db0

Browse files
committed
[DM/FDT] Fix garble when booting
Fix garble caused by empty implementation of earlycon series function in driver.If driver isn't offer earlycon_id or rt_f dt_earlycon_id.setup function but open option, the checking of best_earlycon_id will failed. Signed-off-by: 1078249029 <[email protected]>
1 parent 45eea78 commit bdf5db0

File tree

1 file changed

+5
-3
lines changed
  • components/drivers/ofw

1 file changed

+5
-3
lines changed

components/drivers/ofw/fdt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ rt_err_t rt_fdt_scan_chosen_stdout(void)
592592
int offset;
593593
int len, options_len = 0;
594594
const char *options = RT_NULL, *con_type = RT_NULL;
595+
struct rt_fdt_earlycon_id *earlycon_id, *earlycon_id_end, *best_earlycon_id = RT_NULL;
595596

596597
rt_memset(&fdt_earlycon, 0, rt_offsetof(struct rt_fdt_earlycon, msg_idx));
597598
fdt_earlycon.nodeoffset = -1;
@@ -658,7 +659,6 @@ rt_err_t rt_fdt_scan_chosen_stdout(void)
658659
if (options)
659660
{
660661
int type_len = 0;
661-
struct rt_fdt_earlycon_id *earlycon_id, *earlycon_id_end, *best_earlycon_id = RT_NULL;
662662

663663
earlycon_id = (struct rt_fdt_earlycon_id *)&_earlycon_start;
664664
earlycon_id_end = (struct rt_fdt_earlycon_id *)&_earlycon_end;
@@ -783,8 +783,10 @@ rt_err_t rt_fdt_scan_chosen_stdout(void)
783783
if (fdt_earlycon.msg_idx)
784784
{
785785
fdt_earlycon.msg_idx = 0;
786-
787-
rt_kputs(fdt_earlycon.msg);
786+
if(best_earlycon_id != RT_NULL)
787+
{
788+
rt_kputs(fdt_earlycon.msg);
789+
}
788790
}
789791

790792
rt_fdt_boot_dump();

0 commit comments

Comments
 (0)