of/fdt: fix error checking for earlycon address

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: fb11ffe74c ("of/fdt: add FDT serial scanning for earlycon")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Masahiro Yamada 2015-10-23 20:47:20 +09:00 committed by Rob Herring
parent 001cf5048e
commit 3f5ceec964

View File

@ -822,14 +822,15 @@ static 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);