of/fdt: fix error checking for earlycon address
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 23 Oct 2015 11:47:20 +0000 (20:47 +0900)
committerRob Herring <robh@kernel.org>
Tue, 27 Oct 2015 20:52:29 +0000 (15:52 -0500)
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 <yamada.masahiro@socionext.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/fdt.c

index 9fc3568302265811c5a0ae37ec6a245179ec11df..196e449fc85302602fa9f3cc560c5a92b2718add 100644 (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);