From b9066ffc136afd2e46e8d033c4edce98f5557afc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jul 2018 10:27:30 -0600 Subject: dtoc: Fix Fdt.GetNode() to handle a missing node At present the algortihm is not correct since it will return the root node if the requested node is not found and there are no slashes in the requested node name. Fix this and add a test. Signed-off-by: Simon Glass --- tools/dtoc/test_fdt.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/dtoc/test_fdt.py') diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index e57298dbe7..9fef8ed549 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -205,6 +205,9 @@ class TestProp(unittest.TestCase): self.node = self.dtb.GetNode('/spl-test') self.fdt = self.dtb.GetFdtObj() + def testMissingNode(self): + self.assertEqual(None, self.dtb.GetNode('missing')) + def testPhandle(self): dtb = fdt.FdtScan('tools/dtoc/dtoc_test_phandle.dts') node = dtb.GetNode('/phandle-source') -- cgit v1.2.3