dtc/libfdt
Thierry Reding 2bc5b66d7f libfdt: Add new maximum phandle lookup function
The fdt_get_max_phandle() function has some shortcomings. On one hand
it returns just a uint32_t which means to check for the "negative"
error code a caller has to explicitly check against the error code
(uint32_t)-1. In addition, the -1 is the only error code that can be
returned, so a caller cannot tell the difference between the various
failures.

Fix this by adding a new fdt_find_max_phandle() function that returns an
error code on failure and 0 on success, just like other APIs, and stores
the maximum phandle value in an output argument on success.

This also refactors fdt_get_max_phandle() to use the new function. Add a
note pointing out that the new fdt_find_max_phandle() function should be
preferred over fdt_get_max_phandle().

Signed-off-by: Thierry Reding <treding@nvidia.com>
Message-Id: <20190326153302.17109-1-thierry.reding@gmail.com>
[dwg: Reword for some inaccuracies in the commit message]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-29 13:29:51 +11:00
..
Makefile.libfdt Remove broken objdir / srcdir support 2018-11-23 21:58:42 +11:00
TODO dtc: Update TODO files 2007-12-19 08:20:26 -06:00
fdt.c libfdt: Add fdt_header_size() 2018-06-07 11:49:14 +10:00
fdt.h libfdt: Remove leading underscores from identifiers 2017-10-26 09:25:14 +02:00
fdt_addresses.c libfdt: add fdt_append_addrrange() 2019-03-29 12:12:29 +11:00
fdt_empty_tree.c Fix a few whitespace and style nits 2017-04-09 20:56:37 +10:00
fdt_overlay.c libfdt: Clean up header checking functions 2018-06-07 11:45:44 +10:00
fdt_ro.c libfdt: Add new maximum phandle lookup function 2019-03-29 13:29:51 +11:00
fdt_rw.c libfdt: Clean up header checking functions 2018-06-07 11:45:44 +10:00
fdt_strerror.c libfdt: add missing errors to fdt_strerror() 2016-11-04 07:17:20 +11:00
fdt_sw.c libfdt: Add necessary header padding in fdt_create() 2018-07-09 15:03:14 +10:00
fdt_wip.c libfdt: Remove leading underscores from identifiers 2017-10-26 09:25:14 +02:00
libfdt.h libfdt: Add new maximum phandle lookup function 2019-03-29 13:29:51 +11:00
libfdt_env.h libfdt: Add new maximum phandle lookup function 2019-03-29 13:29:51 +11:00
libfdt_internal.h libfdt: Clean up header checking functions 2018-06-07 11:45:44 +10:00
version.lds libfdt: Add new maximum phandle lookup function 2019-03-29 13:29:51 +11:00