mtd: delete unnecessary checks before two function calls
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 20 Nov 2014 12:50:43 +0000 (13:50 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 26 Nov 2014 06:44:10 +0000 (22:44 -0800)
The functions kfree() and pci_dev_put() test whether their argument is NULL
and then return 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: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/devices/pmc551.c

index 3096f3ded3adf051454d5a99176267b070ceae2d..286b97a304cfcd522985c42eec364767aecceff8 100644 (file)
@@ -2654,8 +2654,7 @@ static void cfi_intelext_destroy(struct mtd_info *mtd)
        kfree(cfi);
        for (i = 0; i < mtd->numeraseregions; i++) {
                region = &mtd->eraseregions[i];
-               if (region->lockmap)
-                       kfree(region->lockmap);
+               kfree(region->lockmap);
        }
        kfree(mtd->eraseregions);
 }
index f02603e1bfeb974ca08a101ae8bb58927c1d1f81..708b7e8c8b18ca27e00a6b9c59b11125808dfbdb 100644 (file)
@@ -812,8 +812,7 @@ static int __init init_pmc551(void)
        }
 
        /* Exited early, reference left over */
-       if (PCI_Device)
-               pci_dev_put(PCI_Device);
+       pci_dev_put(PCI_Device);
 
        if (!pmc551list) {
                printk(KERN_NOTICE "pmc551: not detected\n");