diff mbox

[07/12] core/mem_region: Check return value of add_region() (CID 147251)

Message ID 20170803064551.3439-7-cyril.bur@au1.ibm.com
State Accepted
Headers show

Commit Message

Cyril Bur Aug. 3, 2017, 6:45 a.m. UTC
Just print an error if a region failed to add - at least then there will
be a trace somewhere about the problem.

Fixes: CID 147251
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
---
 core/mem_region.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/core/mem_region.c b/core/mem_region.c
index a0986859..3c93cd47 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -995,7 +995,11 @@  static bool mem_region_parse_reserved_nodes(const char *path)
 				dt_get_number(reg->prop, 2),
 				dt_get_number(reg->prop + sizeof(u64), 2),
 				node, type);
-		add_region(region);
+		if (!add_region(region)) {
+			char *nodepath = dt_get_path(node);
+			prerror("node %s failed to add_region()\n", nodepath);
+			free(nodepath);
+		}
 	}
 
 	return true;