Commit b1374051 authored by Mariusz Kozlowski's avatar Mariusz Kozlowski Committed by Paul Mackerras

[POWERPC] arch/ppc/kernel/prom.c of_node_(get|put) cleanup

Remove redundant argument checks for of_node_get() and of_node_put().
Signed-off-by: default avatarMariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent a2894cfb
...@@ -1221,8 +1221,7 @@ struct device_node *of_find_node_by_name(struct device_node *from, ...@@ -1221,8 +1221,7 @@ struct device_node *of_find_node_by_name(struct device_node *from,
if (np->name != NULL && strcasecmp(np->name, name) == 0 if (np->name != NULL && strcasecmp(np->name, name) == 0
&& of_node_get(np)) && of_node_get(np))
break; break;
if (from) of_node_put(from);
of_node_put(from);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return np; return np;
} }
...@@ -1250,8 +1249,7 @@ struct device_node *of_find_node_by_type(struct device_node *from, ...@@ -1250,8 +1249,7 @@ struct device_node *of_find_node_by_type(struct device_node *from,
if (np->type != 0 && strcasecmp(np->type, type) == 0 if (np->type != 0 && strcasecmp(np->type, type) == 0
&& of_node_get(np)) && of_node_get(np))
break; break;
if (from) of_node_put(from);
of_node_put(from);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return np; return np;
} }
...@@ -1285,8 +1283,7 @@ struct device_node *of_find_compatible_node(struct device_node *from, ...@@ -1285,8 +1283,7 @@ struct device_node *of_find_compatible_node(struct device_node *from,
if (device_is_compatible(np, compatible) && of_node_get(np)) if (device_is_compatible(np, compatible) && of_node_get(np))
break; break;
} }
if (from) of_node_put(from);
of_node_put(from);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return np; return np;
} }
...@@ -1329,8 +1326,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) ...@@ -1329,8 +1326,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
for (np = allnodes; np != 0; np = np->allnext) for (np = allnodes; np != 0; np = np->allnext)
if (np->linux_phandle == handle) if (np->linux_phandle == handle)
break; break;
if (np) of_node_get(np);
of_node_get(np);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return np; return np;
} }
...@@ -1353,8 +1349,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev) ...@@ -1353,8 +1349,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
for (; np != 0; np = np->allnext) for (; np != 0; np = np->allnext)
if (of_node_get(np)) if (of_node_get(np))
break; break;
if (prev) of_node_put(prev);
of_node_put(prev);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return np; return np;
} }
...@@ -1399,8 +1394,7 @@ struct device_node *of_get_next_child(const struct device_node *node, ...@@ -1399,8 +1394,7 @@ struct device_node *of_get_next_child(const struct device_node *node,
for (; next != 0; next = next->sibling) for (; next != 0; next = next->sibling)
if (of_node_get(next)) if (of_node_get(next))
break; break;
if (prev) of_node_put(prev);
of_node_put(prev);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return next; return next;
} }
......
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