Skip to contentSkip to conversation

libfdt: fix bugs

PATCH New Masahiro Yamada 3 participants 14 messages Jul 14, 2015 – Jul 20, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover 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(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/3 libfdt: fix description of fdt_get_string()

Looks like this comment was copied from that of
fdt_get_string_index().

Fixes 5094eb408a5d ("fdt: Add functions to retrieve strings")

---

Changes in v2: None

 include/libfdt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/libfdt.h +1 -1
index f3cbb63..421d64f 100644
@@ -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
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/3 libfdt: fix description of fdt_get_string()

Quoted 11 lines · Masahiro Yamada

Looks like this comment was copied from that of
fdt_get_string_index().

Fixes 5094eb408a5d ("fdt: Add functions to retrieve strings")

---

Changes in v2: None

 include/libfdt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw

PATCH v2 1/3 libfdt: fix description of fdt_get_string()

Quoted 8 lines · Simon Glass
Quoted 7 lines · Masahiro Yamada

Looks like this comment was copied from that of
fdt_get_string_index().

Fixes 5094eb408a5d ("fdt: Add functions to retrieve strings")

---

Quoted 6 lines
Quoted 4 lines

Changes in v2: None

 include/libfdt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-fdt, thanks!

#4 lore raw

PATCH v2 2/3 libfdt: fix error code of fdt_get_string_index()

In reply to Masahiro Yamada

As mentioned in the comment block in include/libfdt.h, fdt_get_string_index() is supposed to return a negative value on error.

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(-)
lib/libfdt/fdt_ro.c +1 -1
index 44fc0aa..38bfcbd 100644
@@ -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,
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 2/3 libfdt: fix error code of fdt_get_string_index()

Quoted 6 lines · Masahiro Yamada

As mentioned in the comment block in include/libfdt.h, fdt_get_string_index() is supposed to return a negative value on error.

Fixes 5094eb408a5d ("fdt: Add functions to retrieve strings")
Quoted 8 lines

---

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(-)
#6 lore raw

PATCH v2 2/3 libfdt: fix error code of fdt_get_string_index()

Quoted 9 lines · Simon Glass
Quoted 8 lines · Masahiro Yamada

As mentioned in the comment block in include/libfdt.h, fdt_get_string_index() is supposed to return a negative value on error.

Fixes 5094eb408a5d ("fdt: Add functions to retrieve strings")

---

Quoted 8 lines
Quoted 6 lines

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(-)

Applied to u-boot-fdt, thanks!

#7 lore raw

PATCH v2 3/3 libfdt: fix error code of fdt_count_strings()

In reply to Masahiro Yamada

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).

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(-)
lib/libfdt/fdt_ro.c +1 -1
index 38bfcbd..7b0777b 100644
@@ -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);
Signature · 1 line
1.9.1
#8 lore raw

PATCH v2 3/3 libfdt: fix error code of fdt_count_strings()

Quoted 30 lines · Masahiro Yamada

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).

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(-)
lib/libfdt/fdt_ro.c +1 -2
index 38bfcbd..7b0777b 100644
@@ -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);
--
Quoted 2 lines

1.9.1

#9 lore raw

PATCH v2 3/3 libfdt: fix error code of fdt_count_strings()

Quoted 28 lines · Simon Glass
Quoted 27 lines · Masahiro Yamada

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).

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(-)
lib/libfdt/fdt_ro.c +1 -1
index 38bfcbd..7b0777b 100644
@@ -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;
 
Quoted 7 lines
Quoted 5 lines
lib/libfdt/fdt_ro.c +0 -1
        for (i = 0; i < length; i++) {
                int len = strlen(list);
--

1.9.1

Applied to u-boot-fdt, thanks!

#10 lore raw

v2 cover libfdt: fix bugs

In reply to Masahiro Yamada
Quoted 4 lines · Masahiro Yamada

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

#11 lore raw

v2 cover libfdt: fix bugs

Hi Scott,

Quoted 10 lines · Scott Wood
Quoted 4 lines · Masahiro Yamada

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

#12 lore raw

v2 cover libfdt: fix bugs

Quoted 12 lines · Simon Glass

Hi Scott,

Quoted 9 lines · Scott Wood
Quoted 4 lines · Masahiro Yamada

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?

Quoted 6 lines
Quoted 1 line

-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

#13 lore raw

v2 cover libfdt: fix bugs

+Thierry

Hi Scott,

Quoted 15 lines · Scott Wood
Quoted 14 lines · Simon Glass

Hi Scott,

Quoted 10 lines · Scott Wood
Quoted 4 lines · Masahiro Yamada

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

Quoted 7 lines
Quoted 4 lines

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