diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-07-15 01:08:44 +0900 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-07-20 07:21:47 -0600 |
commit | 73e1e7952a2a629dc071d894594df4852acc11ad (patch) | |
tree | 6dc4db45e038d5ec0f580600e081833479eef682 | |
parent | 31f334abc516a37257d09c4492808f3238e129fa (diff) | |
download | u-boot-imx-73e1e7952a2a629dc071d894594df4852acc11ad.zip u-boot-imx-73e1e7952a2a629dc071d894594df4852acc11ad.tar.gz u-boot-imx-73e1e7952a2a629dc071d894594df4852acc11ad.tar.bz2 |
libfdt: fix error code of fdt_count_strings()
Currently, this function returns a positive value on error,
so we never know whether this function has succeeded or failed.
For example, if the given property is not found, fdt_getprop()
returns -FDT_ERR_NOTFOUND, and then this function inverts it,
i.e., returns FDT_ERR_NOTFOUND (=1).
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Fixes: bc4147ab2d69 ("fdt: Add a function to count strings")
Acked-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | lib/libfdt/fdt_ro.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libfdt/fdt_ro.c b/lib/libfdt/fdt_ro.c index 38bfcbd..7b0777b 100644 --- a/lib/libfdt/fdt_ro.c +++ b/lib/libfdt/fdt_ro.c @@ -517,7 +517,7 @@ int fdt_count_strings(const void *fdt, int node, const char *property) list = fdt_getprop(fdt, node, property, &length); if (!list) - return -length; + return length; for (i = 0; i < length; i++) { int len = strlen(list); |