aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-10-02 08:08:02 -0400
committerGrant Likely <grant.likely@linaro.org>2014-10-04 16:20:18 -0400
commitfc59b4479c172e413df615cea1635247265e07a0 (patch)
treea17490b63373d95e7a72de2ffdbd4dd025ebd2e4 /drivers/of/base.c
parentf2051d6a88cd03f74221da887f56d778a1b2f1f1 (diff)
of: Don't try to search when phandle == 0
A value of '0' isn't a valid phandle, so searching for a node with that phandle is pointless. It will result in nothing but false positives. Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 293ed4b687ba..2305dc0382bc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1021,6 +1021,9 @@ struct device_node *of_find_node_by_phandle(phandle handle)
1021 struct device_node *np; 1021 struct device_node *np;
1022 unsigned long flags; 1022 unsigned long flags;
1023 1023
1024 if (!handle)
1025 return NULL;
1026
1024 raw_spin_lock_irqsave(&devtree_lock, flags); 1027 raw_spin_lock_irqsave(&devtree_lock, flags);
1025 for (np = of_allnodes; np; np = np->allnext) 1028 for (np = of_allnodes; np; np = np->allnext)
1026 if (np->phandle == handle) 1029 if (np->phandle == handle)