aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/unittest.c
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2018-10-04 23:36:18 -0400
committerFrank Rowand <frank.rowand@sony.com>2018-11-09 01:12:03 -0500
commit2fe0e8769df9fed5098daea7db933bc414c329d7 (patch)
tree9596b2739bf643a769f1c93e124bbc6d89c62e7d /drivers/of/unittest.c
parentc168263b5a10d2434ad5051be8dda47baa34a98e (diff)
of: overlay: check prevents multiple fragments touching same property
Add test case of two fragments updating the same property. After adding the test case, the system hangs at end of boot, after after slub stack dumps from kfree() in crypto modprobe code. Multiple overlay fragments adding, modifying, or deleting the same property is not supported. Add check to detect the attempt and fail the overlay apply. Before this patch, the first fragment error would terminate processing. Allow fragment checking to proceed and report all of the fragment errors before terminating the overlay apply. This is not a hot path, thus not a performance issue (the error is not transient and requires fixing the overlay before attempting to apply it again). After applying this patch, the devicetree unittest messages will include: OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail ... ### dt-test ### end of unittest - 212 passed, 0 failed The check to detect two fragments updating the same property is folded into the patch that created the test case to maintain bisectability. Tested-by: Alan Tull <atull@kernel.org> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Diffstat (limited to 'drivers/of/unittest.c')
-rw-r--r--drivers/of/unittest.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index f82edf829f43..f0139d1e8b63 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2162,6 +2162,7 @@ OVERLAY_INFO_EXTERN(overlay_12);
2162OVERLAY_INFO_EXTERN(overlay_13); 2162OVERLAY_INFO_EXTERN(overlay_13);
2163OVERLAY_INFO_EXTERN(overlay_15); 2163OVERLAY_INFO_EXTERN(overlay_15);
2164OVERLAY_INFO_EXTERN(overlay_bad_add_dup_node); 2164OVERLAY_INFO_EXTERN(overlay_bad_add_dup_node);
2165OVERLAY_INFO_EXTERN(overlay_bad_add_dup_prop);
2165OVERLAY_INFO_EXTERN(overlay_bad_phandle); 2166OVERLAY_INFO_EXTERN(overlay_bad_phandle);
2166OVERLAY_INFO_EXTERN(overlay_bad_symbol); 2167OVERLAY_INFO_EXTERN(overlay_bad_symbol);
2167 2168
@@ -2185,6 +2186,7 @@ static struct overlay_info overlays[] = {
2185 OVERLAY_INFO(overlay_13, 0), 2186 OVERLAY_INFO(overlay_13, 0),
2186 OVERLAY_INFO(overlay_15, 0), 2187 OVERLAY_INFO(overlay_15, 0),
2187 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL), 2188 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL),
2189 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL),
2188 OVERLAY_INFO(overlay_bad_phandle, -EINVAL), 2190 OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
2189 OVERLAY_INFO(overlay_bad_symbol, -EINVAL), 2191 OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
2190 {} 2192 {}
@@ -2435,6 +2437,9 @@ static __init void of_unittest_overlay_high_level(void)
2435 unittest(overlay_data_apply("overlay_bad_add_dup_node", NULL), 2437 unittest(overlay_data_apply("overlay_bad_add_dup_node", NULL),
2436 "Adding overlay 'overlay_bad_add_dup_node' failed\n"); 2438 "Adding overlay 'overlay_bad_add_dup_node' failed\n");
2437 2439
2440 unittest(overlay_data_apply("overlay_bad_add_dup_prop", NULL),
2441 "Adding overlay 'overlay_bad_add_dup_prop' failed\n");
2442
2438 unittest(overlay_data_apply("overlay_bad_phandle", NULL), 2443 unittest(overlay_data_apply("overlay_bad_phandle", NULL),
2439 "Adding overlay 'overlay_bad_phandle' failed\n"); 2444 "Adding overlay 'overlay_bad_phandle' failed\n");
2440 2445