Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Delete unnecessary checks before kfree()

The kfree() function tests whether its argument is NULL and then returns
immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Markus Elfring and committed by
Michael Ellerman
7f4eec39 7e73a3b7

+3 -4
+1 -1
arch/powerpc/lib/rheap.c
··· 284 284 */ 285 285 void rh_destroy(rh_info_t * info) 286 286 { 287 - if ((info->flags & RHIF_STATIC_BLOCK) == 0 && info->block != NULL) 287 + if ((info->flags & RHIF_STATIC_BLOCK) == 0) 288 288 kfree(info->block); 289 289 290 290 if ((info->flags & RHIF_STATIC_INFO) == 0)
+2 -3
arch/powerpc/platforms/cell/celleb_pci.c
··· 393 393 394 394 error: 395 395 if (mem_init_done) { 396 - if (config && *config) 396 + if (config) 397 397 kfree(*config); 398 - if (res && *res) 398 + if (res) 399 399 kfree(*res); 400 - 401 400 } else { 402 401 if (config && *config) { 403 402 size = 256;