[PATCH 4/4] test: self: warn and exit if device tree parsing fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



selftest DTs are compiled into barebox, so it's not expected that they
fail to parse. Nevertheless, error conditions shouldn't be ignored,
so warn about it and early exit.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 test/self/of_manipulation.c | 2 ++
 test/self/regulator.c       | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/test/self/of_manipulation.c b/test/self/of_manipulation.c
index 64913ac1eab8..8d645b113732 100644
--- a/test/self/of_manipulation.c
+++ b/test/self/of_manipulation.c
@@ -121,6 +121,8 @@ static void __init test_of_manipulation(void)
 
 	expected = of_unflatten_dtb(__dtb_of_manipulation_start,
 				    __dtb_of_manipulation_end - __dtb_of_manipulation_start);
+	if (WARN_ON(IS_ERR(expected)))
+		return;
 
 	assert_equal(root, expected);
 
diff --git a/test/self/regulator.c b/test/self/regulator.c
index 08073cfc9158..bcbcbe33e12f 100644
--- a/test/self/regulator.c
+++ b/test/self/regulator.c
@@ -175,6 +175,8 @@ static void test_regulator(void)
 			return;
 
 		overlay = of_unflatten_dtb(__dtbo_test_regulator_start, INT_MAX);
+		if (WARN_ON(IS_ERR(overlay)))
+			return;
 		of_overlay_apply_tree(of_get_root_node(), overlay);
 		of_probe();
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux