[PATCH v3 1/2] arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()

Himadri Pandya himadri18.07 at gmail.com
Wed Feb 27 20:51:37 AEDT 2019


Decrement the reference count on device_node "node" while breaking out
of the loop. Issue identified by Coccinelle.

Signed-off-by: Himadri Pandya <himadri18.07 at gmail.com>
---
Changes in V2:
	- Change subject line
---
Changes in V3:
	- Add braces around the if block
---
 arch/powerpc/kernel/machine_kexec_64.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index a0f6f45005bd..ef484a25fc50 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -64,8 +64,10 @@ int default_machine_kexec_prepare(struct kimage *image)
 			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;
+			}
 		}
 	}
 
-- 
2.17.1



More information about the Linuxppc-dev mailing list