diff mbox

abort if device tree parsing fails

Message ID 20141126111157.43eafebd@kryten
State Accepted, archived
Headers show

Commit Message

Anton Blanchard Nov. 26, 2014, 12:11 a.m. UTC
I debugged a checkstop with a BML boot which turned out to be device
tree issues. A corrupt device tree is very likely to result in a
later checkstop, so abort in dt_expand to make debugging much easier.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 core/device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stewart Smith Nov. 26, 2014, 7:47 a.m. UTC | #1
Anton Blanchard <anton@samba.org> writes:
> I debugged a checkstop with a BML boot which turned out to be device
> tree issues. A corrupt device tree is very likely to result in a
> later checkstop, so abort in dt_expand to make debugging much easier.

thanks, applied!

I also added attribute((warn_unused_result)) and am proceeding to
sprinkle that around the place.
diff mbox

Patch

diff --git a/core/device.c b/core/device.c
index 28cccb7..ffc38f8 100644
--- a/core/device.c
+++ b/core/device.c
@@ -691,7 +691,8 @@  void dt_expand(const void *fdt)
 
 	dt_root = dt_new_root("");
 
-	dt_expand_node(dt_root, fdt, 0);
+	if (dt_expand_node(dt_root, fdt, 0) < 0)
+		abort();
 }
 
 u64 dt_get_number(const void *pdata, unsigned int cells)