فهرست منبع

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>
Masahiro Yamada 9 سال پیش
والد
کامیت
73e1e7952a
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      lib/libfdt/fdt_ro.c

+ 1 - 1
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);
 	list = fdt_getprop(fdt, node, property, &length);
 	if (!list)
 	if (!list)
-		return -length;
+		return length;
 
 
 	for (i = 0; i < length; i++) {
 	for (i = 0; i < length; i++) {
 		int len = strlen(list);
 		int len = strlen(list);