aboutsummaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-09-24 17:26:20 +0200
committerSimon Glass <sjg@chromium.org>2020-10-06 09:07:54 -0600
commit6d9949fe866751c527c5dafab5350af89b7b8332 (patch)
tree51b073975092d29df11ff9b60bf2bf9b5c244fc0 /include/dm
parent45dbe75da6fbc3de280021bf4b5c9dfc94c70f8f (diff)
downloadu-boot-6d9949fe866751c527c5dafab5350af89b7b8332.zip
u-boot-6d9949fe866751c527c5dafab5350af89b7b8332.tar.gz
u-boot-6d9949fe866751c527c5dafab5350af89b7b8332.tar.bz2
dm: update test on of_offset in ofnode_valid
Update the test for node.of_offset because an invalid offset is not always set to -1 because the return value of the libfdt functions are: + an error with a value < 0 + a valid offset with value >=0 For example, in ofnode_get_by_phandle() function, we have: node.of_offset = fdt_node_offset_by_phandle(gd->fdt_blob, phandle); and this function can return -FDT_ERR_BADPHANDLE (-6). Without this patch, the added test dm_test_ofnode_get_by_phandle failed. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/ofnode.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index d7852da..98c64fe 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -128,7 +128,7 @@ static inline bool ofnode_valid(ofnode node)
if (of_live_active())
return node.np != NULL;
else
- return node.of_offset != -1;
+ return node.of_offset >= 0;
}
/**