diff mbox

[03/12] OPAL: Validate before creating opal device tree node

Message ID 20150406070354.10986.37506.stgit@localhost.localdomain
State Superseded
Headers show

Commit Message

Vasant Hegde April 6, 2015, 7:04 a.m. UTC
On FSP based machine, attention LED location code is passed to OPAL
via HDAT. We want to populate this information in device tree under
led node, so that LED driver can use this information.

Presently we are creating '/ibm,opal' node after parsing hdata
information. This patch validates '/ibm,opal' node before creating.
So on FSP based machine we can create this node in hdata itself
without breaking.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 core/opal.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/core/opal.c b/core/opal.c
index 45ee2e2..5776e61 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -143,7 +143,11 @@  void add_opal_node(void)
 	size = (CPU_STACKS_BASE +
 		(cpu_max_pir + 1) * STACK_SIZE) - SKIBOOT_BASE;
 
-	opal_node = dt_new(dt_root, "ibm,opal");
+	if (!opal_node) {
+		opal_node = dt_new(dt_root, "ibm,opal");
+		assert(opal_node);
+	}
+
 	dt_add_property_cells(opal_node, "#address-cells", 0);
 	dt_add_property_cells(opal_node, "#size-cells", 0);
 	dt_add_property_strings(opal_node, "compatible", "ibm,opal-v2",