]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerLuis Henriques <luis.henriques@canonical.com>
Sun, 13 Dec 2015 17:49:40 +0000 (17:49 +0000)
commit 3f5ceec96470050d20d7281d49985e3b1cfc3995 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: 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>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/of/fdt.c

index 5c437ca532b3eaa52868c272acc0feda2bfed214..24ad551291944db0c1d78e5a6e926d5c56ee926f 100644 (file)
@@ -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);