From: Masahiro Yamada Date: Fri, 23 Oct 2015 11:47:20 +0000 (+0900) Subject: of/fdt: fix error checking for earlycon address X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=3f5ceec96470050d20d7281d49985e3b1cfc3995;p=openwrt%2Fstaging%2Fblogic.git 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: fb11ffe74c79 ("of/fdt: add FDT serial scanning for earlycon") Signed-off-by: Masahiro Yamada Signed-off-by: Rob Herring --- diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 9fc356830226..196e449fc853 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -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);