powerpc/crash: remove unnecessary NULL check before kvfree()
authorSourabh Jain <sourabhjain@linux.ibm.com>
Thu, 2 May 2024 18:20:40 +0000 (23:50 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 3 May 2024 02:20:50 +0000 (12:20 +1000)
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/
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240502182040.774759-1-sourabhjain@linux.ibm.com
arch/powerpc/kexec/crash.c

index 21b193e938a37860cf7e7ae68fbecfda0a96e720..9ac3266e49652240c4ecdadb2095ee0a58442c38 100644 (file)
@@ -484,8 +484,7 @@ static void update_crash_elfcorehdr(struct kimage *image, struct memory_notify *
        }
 out:
        kvfree(cmem);
-       if (elfbuf)
-               kvfree(elfbuf);
+       kvfree(elfbuf);
 }
 
 /**