devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@linaro.org>
To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Cc: Grant Likely <grant.likely@linaro.org>
Subject: [PATCH] of/selftest: Move hash table off stack to fix large frame size
Date: Tue,  7 Oct 2014 11:36:05 +0100	[thread overview]
Message-ID: <1412678165-12087-1-git-send-email-grant.likely@linaro.org> (raw)

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 patch applies on my devicetree/next branch, which I'm going to ask
Linux to pull later this week.

g.

 drivers/of/selftest.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
index 4fed34bff5cf..78001270a598 100644
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -198,20 +198,19 @@ struct node_hash {
 	struct device_node *np;
 };
 
+static DEFINE_HASHTABLE(phandle_ht, 8);
 static void __init of_selftest_check_phandles(void)
 {
 	struct device_node *np;
 	struct node_hash *nh;
 	struct hlist_node *tmp;
 	int i, dup_count = 0, phandle_count = 0;
-	DECLARE_HASHTABLE(ht, 8);
 
-	hash_init(ht);
 	for_each_of_allnodes(np) {
 		if (!np->phandle)
 			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) {
 				pr_info("Duplicate phandle! %i used by %s and %s\n",
 					np->phandle, nh->np->full_name, np->full_name);
@@ -225,14 +224,14 @@ static void __init of_selftest_check_phandles(void)
 			return;
 
 		nh->np = np;
-		hash_add(ht, &nh->node, np->phandle);
+		hash_add(phandle_ht, &nh->node, np->phandle);
 		phandle_count++;
 	}
 	selftest(dup_count == 0, "Found %i duplicates in %i phandles\n",
 		 dup_count, phandle_count);
 
 	/* 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);
 		kfree(nh);
 	}
-- 
1.9.1

                 reply	other threads:[~2014-10-07 10:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412678165-12087-1-git-send-email-grant.likely@linaro.org \
    --to=grant.likely@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).