Commit c2187dc4 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Luis Henriques

of/fdt: fix error checking for earlycon address

commit 3f5ceec9 upstream.

fdt_translate_address() returns OF_BAD_ADDR on error.  It is defined as
a u64 value, so the variable "addr" should be defined as u64 as well.

Fixes: fb11ffe7 ("of/fdt: add FDT serial scanning for earlycon")
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent f66ca031
......@@ -774,14 +774,15 @@ int __init early_init_dt_scan_chosen_serial(void)
return -ENODEV;
while (match->compatible[0]) {
unsigned long addr;
u64 addr;
if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
match++;
continue;
}
addr = fdt_translate_address(fdt, offset);
if (!addr)
if (addr == OF_BAD_ADDR)
return -ENXIO;
of_setup_earlycon(addr, match->data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment