]> git.sur5r.net Git - u-boot/commitdiff
common/fdt_support.c: avoid unintended return from fdt_fixup_memory_banks()
authorMiao Yan <miao.yan@windriver.com>
Thu, 28 Nov 2013 09:51:39 +0000 (17:51 +0800)
committerTom Rini <trini@ti.com>
Mon, 16 Dec 2013 13:59:42 +0000 (08:59 -0500)
fdt_fixup_memory_banks() will add and update /memory node in
device tree blob. In the case that /memory node doesn't exist,
after adding a new one, this function returns error.

The correct behavior should be continuing to update its properties.

Signed-off-by: Miao Yan <miao.yan@windriver.com>
common/fdt_support.c

index 1f0d8f5fe9a3348addd99255b4538dd3830fd424..4e32b02aa233118a677a4d0b3d405373b04bf34f 100644 (file)
@@ -400,10 +400,11 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
        nodeoffset = fdt_path_offset(blob, "/memory");
        if (nodeoffset < 0) {
                nodeoffset = fdt_add_subnode(blob, 0, "memory");
-               if (nodeoffset < 0)
+               if (nodeoffset < 0) {
                        printf("WARNING: could not create /memory: %s.\n",
                                        fdt_strerror(nodeoffset));
-               return nodeoffset;
+                       return nodeoffset;
+               }
        }
        err = fdt_setprop(blob, nodeoffset, "device_type", "memory",
                        sizeof("memory"));