From 8993ea78c27e6ebf5ac503cb23ed9b39abfc3490 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Fri, 6 Jan 2017 11:42:06 +1100 Subject: hdat: make HDIF_child() print more useful errors 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 Signed-off-by: Stewart Smith --- hdata/hdif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hdata/hdif.c b/hdata/hdif.c index 25c0000..62ba69f 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; } -- cgit v1.1