]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc: Delete unnecessary checks before kfree()
authorMarkus Elfring <elfring@users.sourceforge.net>
Tue, 3 Feb 2015 12:55:53 +0000 (13:55 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 16 Mar 2015 07:50:14 +0000 (18:50 +1100)
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>
arch/powerpc/lib/rheap.c
arch/powerpc/platforms/cell/celleb_pci.c

index a1060a868e6976144ce14ea47b525e6d9bc2beb0..69abf844c2c30e99121b1da3847efa2aab56ac09 100644 (file)
@@ -284,7 +284,7 @@ EXPORT_SYMBOL_GPL(rh_create);
  */
 void rh_destroy(rh_info_t * info)
 {
-       if ((info->flags & RHIF_STATIC_BLOCK) == 0 && info->block != NULL)
+       if ((info->flags & RHIF_STATIC_BLOCK) == 0)
                kfree(info->block);
 
        if ((info->flags & RHIF_STATIC_INFO) == 0)
index 3ce70ded2d6a95f7601edb0af96cdcbe3c8e937f..9b11b5dd8b7c1fe3fbc82faa07951e61d332a18b 100644 (file)
@@ -393,11 +393,10 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
 
 error:
        if (mem_init_done) {
-               if (config && *config)
+               if (config)
                        kfree(*config);
-               if (res && *res)
+               if (res)
                        kfree(*res);
-
        } else {
                if (config && *config) {
                        size = 256;