[RFC PATCH 03/15] fdtdump: Return an error code on wrong tag value

Herve Codina posted 15 patches 6 hours ago
[RFC PATCH 03/15] fdtdump: Return an error code on wrong tag value
Posted by Herve Codina 6 hours ago
fdtdump prints a message on stderr when it encounters a wrong tag and
stop its processing without returning an error code.

Having a wrong tag is really a failure. Indeed, the processing cannot
continue.

Be more strict. Stop the processing, print a message and return an
error code. In other words, call die().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 fdtdump.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fdtdump.c b/fdtdump.c
index 6c9ad90..0e7a265 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -146,8 +146,7 @@ static void dump_blob(void *blob, bool debug)
 			continue;
 		}
 
-		fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
-		break;
+		die("** Unknown tag 0x%08"PRIx32"\n", tag);
 	}
 }
 
-- 
2.52.0