diff options
author | Grant Likely <grant.likely@linaro.org> | 2014-10-02 17:36:46 +0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-10-05 00:24:35 +0400 |
commit | 2eb46da2a760e5764c48b752a5ef320e02b96b21 (patch) | |
tree | 4d48a347c24c466d5bfe11b33e878585507daa74 /drivers/of/selftest.c | |
parent | 7941b27b16e3282f6ec8817e36492f1deec753a7 (diff) | |
download | linux-2eb46da2a760e5764c48b752a5ef320e02b96b21.tar.xz |
of/selftest: Use the resolver to fixup phandles
The selftest data ends up causing duplicate phandles in the live tree
for the time that the testcase data is inserted into the live tree. This
is obviously a bad situation because anything attempting to read the
tree while the selftests are running make resolve phandles to one of the
testcase data nodes. Fix the problem by using the of_resolve_phandles()
function to eliminate duplicates.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
Diffstat (limited to 'drivers/of/selftest.c')
-rw-r--r-- | drivers/of/selftest.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 4f83e97f8788..4fed34bff5cf 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c @@ -25,7 +25,7 @@ static struct selftest_results { int failed; } selftest_results; -#define NO_OF_NODES 2 +#define NO_OF_NODES 3 static struct device_node *nodes[NO_OF_NODES]; static int last_node_index; static bool selftest_live_tree; @@ -765,6 +765,7 @@ static int __init selftest_data_add(void) extern uint8_t __dtb_testcases_begin[]; extern uint8_t __dtb_testcases_end[]; const int size = __dtb_testcases_end - __dtb_testcases_begin; + int rc; if (!size) { pr_warn("%s: No testcase data to attach; not running tests\n", @@ -785,6 +786,12 @@ static int __init selftest_data_add(void) pr_warn("%s: No tree to attach; not running tests\n", __func__); return -ENODATA; } + of_node_set_flag(selftest_data_node, OF_DETACHED); + rc = of_resolve_phandles(selftest_data_node); + if (rc) { + pr_err("%s: Failed to resolve phandles (rc=%i)\n", __func__, rc); + return -EINVAL; + } if (!of_allnodes) { /* enabling flag for removing nodes */ |