[U-Boot] [PATCH v2 0/3] libfdt: fix bugs

This series fixes bugs of libfdt.
These functions were added by Thierry for U-boot only. So, we do not send it back to the DTC ML.
Masahiro Yamada (3): libfdt: fix description of fdt_get_string() libfdt: fix error code of fdt_get_string_index() libfdt: fix error code of fdt_count_strings()
include/libfdt.h | 2 +- lib/libfdt/fdt_ro.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)

Looks like this comment was copied from that of fdt_get_string_index().
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Fixes: 5094eb408a5d ("fdt: Add functions to retrieve strings") ---
Changes in v2: None
include/libfdt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/libfdt.h b/include/libfdt.h index f3cbb63..421d64f 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -915,7 +915,7 @@ int fdt_get_string_index(const void *fdt, int node, const char *property, int index, const char **output);
/** - * fdt_get_string() - obtain the string at a given index in a string list + * fdt_get_string() - obtain the first string in a string list * @fdt: pointer to the device tree blob * @node: offset of the node * @property: name of the property containing the string list

On 14 July 2015 at 10:08, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Looks like this comment was copied from that of fdt_get_string_index().
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Fixes: 5094eb408a5d ("fdt: Add functions to retrieve strings")
Changes in v2: None
include/libfdt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Simon Glass sjg@chromium.org

On 18 July 2015 at 08:36, Simon Glass sjg@chromium.org wrote:
On 14 July 2015 at 10:08, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Looks like this comment was copied from that of fdt_get_string_index().
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Fixes: 5094eb408a5d ("fdt: Add functions to retrieve strings")
Changes in v2: None
include/libfdt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Simon Glass sjg@chromium.org
Applied to u-boot-fdt, thanks!

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") ---
Changes in v2: - minor fix in git-log (drop "commit") - return code -> error code
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 44fc0aa..38bfcbd 100644 --- a/lib/libfdt/fdt_ro.c +++ b/lib/libfdt/fdt_ro.c @@ -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,

On 14 July 2015 at 10:08, Masahiro Yamada yamada.masahiro@socionext.com wrote:
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")
Changes in v2:
- minor fix in git-log (drop "commit")
- return code -> error code
lib/libfdt/fdt_ro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Simon Glass sjg@chromium.org

On 18 July 2015 at 08:36, Simon Glass sjg@chromium.org wrote:
On 14 July 2015 at 10:08, Masahiro Yamada yamada.masahiro@socionext.com wrote:
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")
Changes in v2:
- minor fix in git-log (drop "commit")
- return code -> error code
lib/libfdt/fdt_ro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Simon Glass sjg@chromium.org
Applied to u-boot-fdt, thanks!

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") ---
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);

On 14 July 2015 at 10:08, Masahiro Yamada yamada.masahiro@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@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@chromium.org

On 18 July 2015 at 08:36, Simon Glass sjg@chromium.org wrote:
On 14 July 2015 at 10:08, Masahiro Yamada yamada.masahiro@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@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@chromium.org
Applied to u-boot-fdt, thanks!

On Wed, 2015-07-15 at 01:08 +0900, Masahiro Yamada wrote:
This series fixes bugs of libfdt.
These functions were added by Thierry for U-boot only. So, we do not send it back to the DTC ML.
If they're not part of upstream dtc, why are they in the libfdt directory? Have they been sent upstream but not merged?
-Scott

Hi Scott,
On 14 July 2015 at 12:16, Scott Wood scottwood@freescale.com wrote:
On Wed, 2015-07-15 at 01:08 +0900, Masahiro Yamada wrote:
This series fixes bugs of libfdt.
These functions were added by Thierry for U-boot only. So, we do not send it back to the DTC ML.
If they're not part of upstream dtc, why are they in the libfdt directory? Have they been sent upstream but not merged?
-Scott
To avoid roadblocks we take patches in libfdt before they are merged upstream. I then tidy things up when I see them applied. So sometimes we are a little ahead of libfdt for a while. It works out OK since we need to sync with upstream regularly anyway.
Regards, Simon

On Sat, 2015-07-18 at 08:36 -0600, Simon Glass wrote:
Hi Scott,
On 14 July 2015 at 12:16, Scott Wood scottwood@freescale.com wrote:
On Wed, 2015-07-15 at 01:08 +0900, Masahiro Yamada wrote:
This series fixes bugs of libfdt.
These functions were added by Thierry for U-boot only. So, we do not send it back to the DTC ML.
If they're not part of upstream dtc, why are they in the libfdt directory? Have they been sent upstream but not merged?
-Scott
To avoid roadblocks we take patches in libfdt before they are merged upstream. I then tidy things up when I see them applied. So sometimes we are a little ahead of libfdt for a while. It works out OK since we need to sync with upstream regularly anyway.
That's fine, but from what Masahiro said, it sounded like there was no intent to ever push these to upstream dtc.
-Scott

+Thierry
Hi Scott,
On 18 July 2015 at 11:42, Scott Wood scottwood@freescale.com wrote:
On Sat, 2015-07-18 at 08:36 -0600, Simon Glass wrote:
Hi Scott,
On 14 July 2015 at 12:16, Scott Wood scottwood@freescale.com wrote:
On Wed, 2015-07-15 at 01:08 +0900, Masahiro Yamada wrote:
This series fixes bugs of libfdt.
These functions were added by Thierry for U-boot only. So, we do not send it back to the DTC ML.
If they're not part of upstream dtc, why are they in the libfdt directory? Have they been sent upstream but not merged?
-Scott
To avoid roadblocks we take patches in libfdt before they are merged upstream. I then tidy things up when I see them applied. So sometimes we are a little ahead of libfdt for a while. It works out OK since we need to sync with upstream regularly anyway.
That's fine, but from what Masahiro said, it sounded like there was no intent to ever push these to upstream dtc.
I think it as just forgotten. Thierry sent it a few days ago and it looks promising so far.
Regards, Simon
participants (3)
-
Masahiro Yamada
-
Scott Wood
-
Simon Glass