From 1c17714dbb3aa43e5b7927dfc073e5e88ae20655 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 2 Jul 2019 18:08:15 -0600 Subject: pylibfdt: Correct the FdtSw example At present this example is incorrect since it is missing the call to finish_reservemap() and does not add a root node. Fix these problems. Signed-off-by: Simon Glass Message-Id: <20190703000815.102459-1-sjg@chromium.org> Signed-off-by: David Gibson --- pylibfdt/libfdt.i | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pylibfdt') diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i index 643f95d..ecec4dd 100644 --- a/pylibfdt/libfdt.i +++ b/pylibfdt/libfdt.i @@ -727,8 +727,10 @@ class FdtSw(FdtRo): # First create the device tree with a node and property: sw = FdtSw() - with sw.add_node('node'): - sw.property_u32('reg', 2) + sw.finish_reservemap() + with sw.add_node(''): + with sw.add_node('node'): + sw.property_u32('reg', 2) fdt = sw.as_fdt() # Now we can use it as a real device tree -- cgit v1.1