[Skiboot] [PATCH] hdat: make HDIF_child() print more useful errors

Oliver O'Halloran oohall at gmail.com
Fri Jan 6 11:42:06 AEDT 2017

The HDAT has very fixed relationships between a parent and child
structures. When parsing the HDAT we always know what type of child
that we expect and we will error out if there is a mismatch between what
we get and what expect. This patch just prints out what we got in
addition to what we expected to help with debugging.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
 hdata/hdif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hdata/hdif.c b/hdata/hdif.c
index 25c00008138f..62ba69f2e887 100644
--- a/hdata/hdif.c
+++ b/hdata/hdif.c
@@ -131,8 +131,8 @@ struct HDIF_common_hdr *HDIF_child(const struct HDIF_common_hdr *hdif,
 	ret = base + be32_to_cpu(child->offset)
 		+ be32_to_cpu(child->size) * idx;
 	if (!HDIF_check(ret, eyecatcher)) {
-		prerror("HDIF: %s child #%i bad type\n",
-			eyecatcher, idx);
+		prerror("HDIF: #%i bad type (wanted %6s, got %6s)\n",
+			idx, eyecatcher, ret->id);
 		return NULL;

More information about the Skiboot mailing list