From: Patrick Delaunay Date: Fri, 25 Sep 2020 07:41:15 +0000 (+0200) Subject: fdtdec: correct test on return of fdt_node_offset_by_phandle X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=cba487c7fc0fea21757cd8dba10271469d5fde9c;p=u-boot.git fdtdec: correct test on return of fdt_node_offset_by_phandle The result of fdt_node_offset_by_phandle is negative for error, so this patch corrects the check of this result in fdtdec_parse_phandle_with_args. This patch allows to have the same behavior with or without OF_LIVE for the function dev_read_phandle_with_args with cell_name = NULL and with invalid phandle. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- diff --git a/lib/fdtdec.c b/lib/fdtdec.c index b8fc5e2bff..ee1bd41b08 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -746,7 +746,7 @@ int fdtdec_parse_phandle_with_args(const void *blob, int src_node, if (cells_name || cur_index == index) { node = fdt_node_offset_by_phandle(blob, phandle); - if (!node) { + if (node < 0) { debug("%s: could not find phandle\n", fdt_get_name(blob, src_node, NULL));