Skip to content

Commit

Permalink
powerpc/numa: Use of_get_next_parent to simplify code
Browse files Browse the repository at this point in the history
of_get_next_parent can be used to simplify the while() loop and
avoid the need of a temp variable.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Christophe Jaillet authored and Michael Ellerman committed Oct 15, 2015
1 parent 5fab1d1 commit 1def375
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions arch/powerpc/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ static int of_node_to_nid_single(struct device_node *device)
/* Walk the device tree upwards, looking for an associativity id */
int of_node_to_nid(struct device_node *device)
{
struct device_node *tmp;
int nid = -1;

of_node_get(device);
Expand All @@ -285,9 +284,7 @@ int of_node_to_nid(struct device_node *device)
if (nid != -1)
break;

tmp = device;
device = of_get_parent(tmp);
of_node_put(tmp);
device = of_get_next_parent(device);
}
of_node_put(device);

Expand Down

0 comments on commit 1def375

Please sign in to comment.