Commit fc59b447 authored by Grant Likely's avatar Grant Likely

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: default avatarGrant Likely <grant.likely@linaro.org>
parent f2051d6a
...@@ -1021,6 +1021,9 @@ struct device_node *of_find_node_by_phandle(phandle handle) ...@@ -1021,6 +1021,9 @@ struct device_node *of_find_node_by_phandle(phandle handle)
struct device_node *np; struct device_node *np;
unsigned long flags; unsigned long flags;
if (!handle)
return NULL;
raw_spin_lock_irqsave(&devtree_lock, flags); raw_spin_lock_irqsave(&devtree_lock, flags);
for (np = of_allnodes; np; np = np->allnext) for (np = of_allnodes; np; np = np->allnext)
if (np->phandle == handle) if (np->phandle == handle)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment