summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-31 17:54:38 -0800
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-16 23:47:10 +1100
commit9625e69a3818cc00fd85632719b4c6c12f7f1b1e (patch)
treef142f6f3f9a129f8849b849a0a3a51365603e2ca /arch/powerpc/platforms/cell
parent94d3084a0f8cbca9ceea2835ac842c7c92c8790c (diff)
downloadlinux-stable-9625e69a3818cc00fd85632719b4c6c12f7f1b1e.tar.gz
linux-stable-9625e69a3818cc00fd85632719b4c6c12f7f1b1e.tar.bz2
linux-stable-9625e69a3818cc00fd85632719b4c6c12f7f1b1e.zip
powerpc: make use of for_each_node_by_type() instead of open-coding it
Instead of manually coding the loop with of_find_node_by_type(), let's switch to the standard macro for iterating over nodes with given type. Also fixed a couple of refcount leaks in the aforementioned loops. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/cell')
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index f636ee22b203..5c409c98cca8 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -292,12 +292,12 @@ static int __init of_enumerate_spus(int (*fn)(void *data))
unsigned int n = 0;
ret = -ENODEV;
- for (node = of_find_node_by_type(NULL, "spe");
- node; node = of_find_node_by_type(node, "spe")) {
+ for_each_node_by_type(node, "spe") {
ret = fn(node);
if (ret) {
printk(KERN_WARNING "%s: Error initializing %s\n",
__func__, node->name);
+ of_node_put(node);
break;
}
n++;