of/selftest: Move hash table off stack to fix large frame size
The new testcase that checks phandle consistency was using a hash table on the stack which made the frame size much large than it should be. Fix the problem by moving the hash table into the file scope. Signed-off-by: Grant Likely <grant.likely@linaro.org>
This commit is contained in:
parent
7419eb064e
commit
2118f4b8df
|
@ -198,20 +198,19 @@ struct node_hash {
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static DEFINE_HASHTABLE(phandle_ht, 8);
|
||||||
static void __init of_selftest_check_phandles(void)
|
static void __init of_selftest_check_phandles(void)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
struct node_hash *nh;
|
struct node_hash *nh;
|
||||||
struct hlist_node *tmp;
|
struct hlist_node *tmp;
|
||||||
int i, dup_count = 0, phandle_count = 0;
|
int i, dup_count = 0, phandle_count = 0;
|
||||||
DECLARE_HASHTABLE(ht, 8);
|
|
||||||
|
|
||||||
hash_init(ht);
|
|
||||||
for_each_of_allnodes(np) {
|
for_each_of_allnodes(np) {
|
||||||
if (!np->phandle)
|
if (!np->phandle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hash_for_each_possible(ht, nh, node, np->phandle) {
|
hash_for_each_possible(phandle_ht, nh, node, np->phandle) {
|
||||||
if (nh->np->phandle == np->phandle) {
|
if (nh->np->phandle == np->phandle) {
|
||||||
pr_info("Duplicate phandle! %i used by %s and %s\n",
|
pr_info("Duplicate phandle! %i used by %s and %s\n",
|
||||||
np->phandle, nh->np->full_name, np->full_name);
|
np->phandle, nh->np->full_name, np->full_name);
|
||||||
|
@ -225,14 +224,14 @@ static void __init of_selftest_check_phandles(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nh->np = np;
|
nh->np = np;
|
||||||
hash_add(ht, &nh->node, np->phandle);
|
hash_add(phandle_ht, &nh->node, np->phandle);
|
||||||
phandle_count++;
|
phandle_count++;
|
||||||
}
|
}
|
||||||
selftest(dup_count == 0, "Found %i duplicates in %i phandles\n",
|
selftest(dup_count == 0, "Found %i duplicates in %i phandles\n",
|
||||||
dup_count, phandle_count);
|
dup_count, phandle_count);
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
hash_for_each_safe(ht, i, tmp, nh, node) {
|
hash_for_each_safe(phandle_ht, i, tmp, nh, node) {
|
||||||
hash_del(&nh->node);
|
hash_del(&nh->node);
|
||||||
kfree(nh);
|
kfree(nh);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue