Skip to contentSkip to conversation

fdt_support.c: avoid unintended return from fdt_fixup_memory_banks()

PATCH New miao.yan at windriver.com 1 participant 1 message Aug 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt_support.c: avoid unintended return from fdt_fixup_memory_banks()

From: Miao Yan <[email protected]>

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.

---
Not sure whether this is fixed or not, we are seeing this error when trying to update a device tree without the "/memory" node.

 common/fdt_support.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/fdt_support.c +3 -2
index 6b9fa05..65056d7 100644
@@ -405,10 +405,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"));
Signature · 1 line
1.7.9.5