for_each_node_with_property performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.

This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci

Signed-off-by: Julia Lawall <julia.law...@inria.fr>

---
 arch/powerpc/kexec/file_load_64.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff -u -p a/arch/powerpc/kexec/file_load_64.c 
b/arch/powerpc/kexec/file_load_64.c
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -1138,11 +1138,15 @@ static int update_pci_dma_nodes(void *fd
                        continue;
 
                ret = copy_property(fdt, pci_offset, dn, "ibm,dma-window");
-               if (ret < 0)
+               if (ret < 0) {
+                       of_node_put(dn);
                        break;
+               }
                ret = copy_property(fdt, pci_offset, dn, dmapropname);
-               if (ret < 0)
+               if (ret < 0) {
+                       of_node_put(dn);
                        break;
+               }
        }
 
        return ret;

Reply via email to