[PATCH] powerpc/crash: remove unnecessary NULL check before kvfree()

Sourabh Jain sourabhjain at linux.ibm.com
Fri May 3 04:20:40 AEST 2024


Fix the following coccicheck build warning:

arch/powerpc/kexec/crash.c:488:2-8: WARNING: NULL check before some
freeing functions is not needed.

Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404261048.skfV5DDB-lkp@intel.com/
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: Stephen Rothwell <sfr at canb.auug.org.au>
Signed-off-by: Sourabh Jain <sourabhjain at linux.ibm.com>
---
 arch/powerpc/kexec/crash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c
index 21b193e938a3..9ac3266e4965 100644
--- a/arch/powerpc/kexec/crash.c
+++ b/arch/powerpc/kexec/crash.c
@@ -484,8 +484,7 @@ static void update_crash_elfcorehdr(struct kimage *image, struct memory_notify *
 	}
 out:
 	kvfree(cmem);
-	if (elfbuf)
-		kvfree(elfbuf);
+	kvfree(elfbuf);
 }
 
 /**
-- 
2.44.0



More information about the Linuxppc-dev mailing list