diff options
author | Thierry Reding <treding@nvidia.com> | 2019-03-26 16:33:00 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-03-02 07:52:19 +0100 |
commit | 6505fe0edea8762955e3c8dc86801bb0679ba4f7 (patch) | |
tree | 3645c16d1510b24c719d1d23391bb79653ed964c /cpukit/include/libfdt_env.h | |
parent | libfdt: add fdt_append_addrrange() (diff) | |
download | rtems-6505fe0edea8762955e3c8dc86801bb0679ba4f7.tar.bz2 |
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>
Diffstat (limited to 'cpukit/include/libfdt_env.h')
-rw-r--r-- | cpukit/include/libfdt_env.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cpukit/include/libfdt_env.h b/cpukit/include/libfdt_env.h index eb2053845c..4d1cdfa585 100644 --- a/cpukit/include/libfdt_env.h +++ b/cpukit/include/libfdt_env.h @@ -52,6 +52,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> |