[PATCH] dm: update test on of_offset in ofnode_valid

Simon Glass sjg at chromium.org
Thu Sep 24 20:54:55 CEST 2020


On Thu, 24 Sep 2020 at 09:26, Patrick Delaunay <patrick.delaunay at st.com> wrote:
>
> 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 at st.com>
> ---
>
>  include/dm/ofnode.h |  2 +-
>  test/dm/ofnode.c    | 16 ++++++++++++++++
>  2 files changed, 17 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list