devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fdtdump: properly handle multi-string properties
@ 2013-01-04 19:12 Pantelis Antoniou
  2013-01-04 23:38 ` David Gibson
       [not found] ` <1357326766-12691-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Pantelis Antoniou @ 2013-01-04 19:12 UTC (permalink / raw)
  To: Jon Loeliger
  Cc: Grant Likely, Rob Herring, devicetree-discuss, linux-kernel,
	Matt Porter, Russ Dill, Pantelis Antoniou

Device tree can store multiple strings in a single property.
We didn't handle that case properly.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 fdtdump.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fdtdump.c b/fdtdump.c
index 207a46d..d4fa6d7 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -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)
-- 
1.7.12

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-06 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-04 19:12 fdtdump: properly handle multi-string properties Pantelis Antoniou
2013-01-04 23:38 ` David Gibson
     [not found] ` <1357326766-12691-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-01-06 21:35   ` Jon Loeliger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).