linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code
@ 2015-10-11 20:27 Christophe JAILLET
  2015-10-11 20:44 ` Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Christophe JAILLET @ 2015-10-11 20:27 UTC (permalink / raw)
  To: benh, paulus, mpe
  Cc: linuxppc-dev, linux-kernel, kernel-janitors, Christophe JAILLET

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>
---
 arch/powerpc/sysdev/mpc5xxx_clocks.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/sysdev/mpc5xxx_clocks.c b/arch/powerpc/sysdev/mpc5xxx_clocks.c
index f4f0301..5732926 100644
--- a/arch/powerpc/sysdev/mpc5xxx_clocks.c
+++ b/arch/powerpc/sysdev/mpc5xxx_clocks.c
@@ -13,7 +13,6 @@
 
 unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
 {
-	struct device_node *np;
 	const unsigned int *p_bus_freq = NULL;
 
 	of_node_get(node);
@@ -22,9 +21,7 @@ unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
 		if (p_bus_freq)
 			break;
 
-		np = of_get_parent(node);
-		of_node_put(node);
-		node = np;
+		node = of_get_next_parent(node);
 	}
 	of_node_put(node);
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-19  4:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-11 20:27 [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code Christophe JAILLET
2015-10-11 20:44 ` Julia Lawall
2015-10-12  5:05   ` Christophe JAILLET
2015-10-14  4:00 ` Michael Ellerman
2015-10-15  5:56   ` [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed memory Christophe JAILLET
2015-10-15  6:36     ` Michael Ellerman
2015-10-16  6:20       ` Christophe JAILLET
2015-10-16  7:15         ` Gabriel Paubert
2015-10-16  9:49         ` Michael Ellerman
2015-10-16 20:05           ` Christophe JAILLET
2015-10-19  4:38             ` Michael Ellerman
2015-10-15 11:11 ` powerpc/mpc5xxx: Use of_get_next_parent to simplify code Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).