libfdt: fix fdt_stringlist_count()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 17 Oct 2016 11:22:33 +0000 (20:22 +0900)
committerTom Rini <trini@konsulko.com>
Mon, 24 Oct 2016 12:04:39 +0000 (08:04 -0400)
If fdt_getprop() fails, negative error code should be returned.

[ DTC commit: e28eff5b787adb3f461d1653598818b2f1f25a73 ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
lib/libfdt/fdt_ro.c

index 7e894b742b456a9fef7f22227c2781ce76ebe24b..fc08981a2c8c86c1d6cf4c9d8d68e98b527c3248 100644 (file)
@@ -550,7 +550,7 @@ int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property)
 
        list = fdt_getprop(fdt, nodeoffset, property, &length);
        if (!list)
-               return -length;
+               return length;
 
        end = list + length;