From: Masahiro Yamada Date: Tue, 14 Jul 2015 16:08:44 +0000 (+0900) Subject: libfdt: fix error code of fdt_count_strings() X-Git-Tag: v2015.10-rc1~184 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=73e1e7952a2a629dc071d894594df4852acc11ad;p=u-boot 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 Fixes: bc4147ab2d69 ("fdt: Add a function to count strings") Acked-by: Simon Glass --- diff --git a/lib/libfdt/fdt_ro.c b/lib/libfdt/fdt_ro.c index 38bfcbdcd5..7b0777b67e 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);