diff options
Diffstat (limited to 'drivers/of/selftest.c')
-rw-r--r-- | drivers/of/selftest.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 11b873c54a77..e2d79afa9dc6 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -896,10 +896,14 @@ static void selftest_data_remove(void) | |||
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | 898 | ||
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) { |
@@ -908,7 +912,6 @@ static void selftest_data_remove(void) | |||
908 | } | 912 | } |
909 | } | 913 | } |
910 | } | 914 | } |
911 | last_node_index--; | ||
912 | } | 915 | } |
913 | } | 916 | } |
914 | 917 | ||
@@ -921,6 +924,8 @@ static int __init of_selftest(void) | |||
921 | res = selftest_data_add(); | 924 | res = selftest_data_add(); |
922 | if (res) | 925 | if (res) |
923 | return res; | 926 | return res; |
927 | if (!of_aliases) | ||
928 | of_aliases = of_find_node_by_path("/aliases"); | ||
924 | 929 | ||
925 | 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"); |
926 | if (!np) { | 931 | if (!np) { |