diff mbox

[06/15] OPAL: Validate before creating opal device tree node

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

Commit Message

Vasant Hegde March 20, 2015, 12:08 p.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 5e96e0a..6047879 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -144,7 +144,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",