summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-09-30 23:16:49 +0200
committerWolfgang Denk <wd@denx.de>2009-09-30 23:16:49 +0200
commitd3909d74ccde4ce465006ead669d0d7b54177fb2 (patch)
treed24f62a3b123ffa7dad733c6c3b055daa554468b
parent984f10baac8ef6032df52f135943d6b0bc96f724 (diff)
parent6e748ea004473cce99fbde6382dd580c10ffdb60 (diff)
downloadu-boot-imx-d3909d74ccde4ce465006ead669d0d7b54177fb2.zip
u-boot-imx-d3909d74ccde4ce465006ead669d0d7b54177fb2.tar.gz
u-boot-imx-d3909d74ccde4ce465006ead669d0d7b54177fb2.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-fdt
-rw-r--r--common/cmd_fdt.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 8683772..919a0bf 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -574,14 +574,18 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len)
* Byte stream. Convert the values.
*/
newp++;
- while ((*newp != ']') && (stridx < count)) {
- tmp = simple_strtoul(newp, &newp, 16);
- *data++ = tmp & 0xFF;
- *len = *len + 1;
+ while ((stridx < count) && (*newp != ']')) {
while (*newp == ' ')
newp++;
- if (*newp != '\0')
+ if (*newp == '\0') {
newp = newval[++stridx];
+ continue;
+ }
+ if (!isxdigit(*newp))
+ break;
+ tmp = simple_strtoul(newp, &newp, 16);
+ *data++ = tmp & 0xFF;
+ *len = *len + 1;
}
if (*newp != ']') {
printf("Unexpected character '%c'\n", *newp);
@@ -589,12 +593,15 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len)
}
} else {
/*
- * Assume it is a string. Copy it into our data area for
- * convenience (including the terminating '\0').
+ * Assume it is one or more strings. Copy it into our
+ * data area for convenience (including the
+ * terminating '\0's).
*/
while (stridx < count) {
- *len = strlen(newp) + 1;
+ size_t length = strlen(newp) + 1;
strcpy(data, newp);
+ data += length;
+ *len += length;
newp = newval[++stridx];
}
}