powerpc/prom: Use of_get_next_parent() in of_get_ibm_chip_id()

Use of_get_next_parent() to simplifiy the logic in of_get_ibm_chip_id().

Original-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Michael Ellerman 2015-10-26 09:48:46 +09:00
parent f755ecfb8c
commit 16c1d60626
1 changed files with 2 additions and 3 deletions

View File

@ -784,7 +784,6 @@ int of_get_ibm_chip_id(struct device_node *np)
{ {
of_node_get(np); of_node_get(np);
while (np) { while (np) {
struct device_node *old = np;
u32 chip_id; u32 chip_id;
/* /*
@ -795,8 +794,8 @@ int of_get_ibm_chip_id(struct device_node *np)
of_node_put(np); of_node_put(np);
return chip_id; return chip_id;
} }
np = of_get_parent(np);
of_node_put(old); np = of_get_next_parent(np);
} }
return -1; return -1;
} }