Skip to contentSkip to conversation

powerpc/kexec: fix for_each_child.cocci warning

PATCH Applied Julia Lawall 2 participants 2 messages Aug 3, 2021 – Aug 18, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/kexec: fix for_each_child.cocci warning

From: kernel test robot <[email protected]>

for_each_node_by_type should have of_node_put() before return.

Generated by: scripts/coccinelle/iterators/for_each_child.cocci

---

The code seems to have been this way since the beginning of time. Perhaps the of_node_put is a no op for this code?

 core_64.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kexec/core_64.c +3 -1
@@ -64,8 +64,10 @@ int default_machine_kexec_prepare(struct
 			begin = image->segment[i].mem;
 			end = begin + image->segment[i].memsz;
 
-			if ((begin < high) && (end > low))
+			if ((begin < high) && (end > low)) {
+				of_node_put(node);
 				return -ETXTBSY;
+			}
 		}
 	}