diff mbox series

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

Message ID 20240502182040.774759-1-sourabhjain@linux.ibm.com (mailing list archive)
State Accepted
Commit 9803af291162dbca4b9773586a3f5c392f0dd974
Headers show
Series powerpc/crash: remove unnecessary NULL check before kvfree() | expand

Commit Message

Sourabh Jain May 2, 2024, 6:20 p.m. UTC
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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404261048.skfV5DDB-lkp@intel.com/
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
 arch/powerpc/kexec/crash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Michael Ellerman May 7, 2024, 2:41 p.m. UTC | #1
On Thu, 02 May 2024 23:50:40 +0530, Sourabh Jain wrote:
> Fix the following coccicheck build warning:
> 
> arch/powerpc/kexec/crash.c:488:2-8: WARNING: NULL check before some
> freeing functions is not needed.
> 
> 

Applied to powerpc/topic/kdump-hotplug.

[1/1] powerpc/crash: remove unnecessary NULL check before kvfree()
      https://git.kernel.org/powerpc/c/9803af291162dbca4b9773586a3f5c392f0dd974

cheers
diff mbox series

Patch

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);
 }
 
 /**