Commit 73e1e795 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Simon Glass

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: default avatarMasahiro Yamada <>
Fixes: bc4147ab ("fdt: Add a function to count strings")
Acked-by: default avatarSimon Glass <>
parent 31f334ab
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment