Skip to content

Commit

Permalink
of: Don't try to search when phandle == 0
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
glikely committed Oct 4, 2014
1 parent f2051d6 commit fc59b44
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,9 @@ struct device_node *of_find_node_by_phandle(phandle handle)
struct device_node *np;
unsigned long flags;

if (!handle)
return NULL;

raw_spin_lock_irqsave(&devtree_lock, flags);
for (np = of_allnodes; np; np = np->allnext)
if (np->phandle == handle)
Expand Down

0 comments on commit fc59b44

Please sign in to comment.