[U-Boot] [PATCH v2 3/3] libfdt: fix error code of fdt_count_strings()

Simon Glass sjg at chromium.org
Mon Jul 20 15:25:55 CEST 2015


On 18 July 2015 at 08:36, Simon Glass <sjg at chromium.org> wrote:
> On 14 July 2015 at 10:08, Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
>> 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 at socionext.com>
>> Fixes: bc4147ab2d69 ("fdt: Add a function to count strings")
>> ---
>>
>> Changes in v2: None
>>
>>  lib/libfdt/fdt_ro.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/libfdt/fdt_ro.c b/lib/libfdt/fdt_ro.c
>> index 38bfcbd..7b0777b 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);
>> --
>> 1.9.1
>>
>
> Acked-by: Simon Glass <sjg at chromium.org>

Applied to u-boot-fdt, thanks!


More information about the U-Boot mailing list