Skip to content

Commit

Permalink
fdtdump: properly handle multi-string properties
Browse files Browse the repository at this point in the history
Device tree can store multiple strings in a single property.
We didn't handle that case properly.

Signed-off-by: Pantelis Antoniou <[email protected]>
Acked-by: David Gibson <[email protected]>
  • Loading branch information
pantoniou authored and Jon Loeliger committed Jan 6, 2013
1 parent e4b497f commit 94a4799
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fdtdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ static void print_data(const char *data, int len)
{
int i;
const char *p = data;
const char *s;

/* no data, don't print */
if (len == 0)
return;

if (util_is_printable_string(data, len)) {
printf(" = \"%s\"", (const char *)data);
printf(" = ");

s = data;
do {
printf("\"%s\"", s);
s += strlen(s) + 1;
if (s < data + len)
printf(", ");
} while (s < data + len);

} else if ((len % 4) == 0) {
printf(" = <");
for (i = 0; i < len; i += 4)
Expand Down

0 comments on commit 94a4799

Please sign in to comment.