libfdt: fix error code of fdt_get_string_index()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 14 Jul 2015 16:08:43 +0000 (01:08 +0900)
committerSimon Glass <sjg@chromium.org>
Mon, 20 Jul 2015 13:21:47 +0000 (07:21 -0600)
As mentioned in the comment block in include/libfdt.h,
fdt_get_string_index() is supposed to return a negative value
on error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Fixes: 5094eb408a5d ("fdt: Add functions to retrieve strings")
Acked-by: Simon Glass <sjg@chromium.org>
lib/libfdt/fdt_ro.c

index 44fc0aa900d2556996ab5f9ef7c87f12fca517ce..38bfcbdcd53d2b4d150b429e6fe38ddbfb1a91a4 100644 (file)
@@ -577,7 +577,7 @@ int fdt_get_string_index(const void *fdt, int node, const char *property,
                index--;
        }
 
-       return FDT_ERR_NOTFOUND;
+       return -FDT_ERR_NOTFOUND;
 }
 
 int fdt_get_string(const void *fdt, int node, const char *property,