aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-11-19 12:13:44 -0500
committerGrant Likely <grant.likely@linaro.org>2014-11-20 10:32:49 -0500
commit788ec2fc2ca295a2d929986e95231214ecd8d142 (patch)
tree17f8d173bf4482bbdde8b7ce9c30d5a10ac033f5 /drivers/of
parentc1a2086e2d8c4eb4e8630ba752e911ec180dec67 (diff)
of/selftest: Fix testing when /aliases is missing
The /aliases node isn't always present in the device tree, but the unittest code assumes that /aliases is there. Add a check when inserting the testcase data to see if of_aliases needs to be updated, and undo the settings when the nodes are removed. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/selftest.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
index e6c14dc400e9..e2d79afa9dc6 100644
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -899,7 +899,11 @@ static void selftest_data_remove(void)
899 while (last_node_index-- > 0) { 899 while (last_node_index-- > 0) {
900 if (nodes[last_node_index]) { 900 if (nodes[last_node_index]) {
901 np = of_find_node_by_path(nodes[last_node_index]->full_name); 901 np = of_find_node_by_path(nodes[last_node_index]->full_name);
902 if (strcmp(np->full_name, "/aliases") != 0) { 902 if (np == nodes[last_node_index]) {
903 if (of_aliases == np) {
904 of_node_put(of_aliases);
905 of_aliases = NULL;
906 }
903 detach_node_and_children(np); 907 detach_node_and_children(np);
904 } else { 908 } else {
905 for_each_property_of_node(np, prop) { 909 for_each_property_of_node(np, prop) {
@@ -920,6 +924,8 @@ static int __init of_selftest(void)
920 res = selftest_data_add(); 924 res = selftest_data_add();
921 if (res) 925 if (res)
922 return res; 926 return res;
927 if (!of_aliases)
928 of_aliases = of_find_node_by_path("/aliases");
923 929
924 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 930 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
925 if (!np) { 931 if (!np) {