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

mtd: delete unnecessary checks before two function calls

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>

authored by

Markus Elfring and committed by
Brian Norris
05a221bb 775a9134

+2 -4
+1 -2
drivers/mtd/chips/cfi_cmdset_0001.c
··· 2654 2654 kfree(cfi); 2655 2655 for (i = 0; i < mtd->numeraseregions; i++) { 2656 2656 region = &mtd->eraseregions[i]; 2657 - if (region->lockmap) 2658 - kfree(region->lockmap); 2657 + kfree(region->lockmap); 2659 2658 } 2660 2659 kfree(mtd->eraseregions); 2661 2660 }
+1 -2
drivers/mtd/devices/pmc551.c
··· 812 812 } 813 813 814 814 /* Exited early, reference left over */ 815 - if (PCI_Device) 816 - pci_dev_put(PCI_Device); 815 + pci_dev_put(PCI_Device); 817 816 818 817 if (!pmc551list) { 819 818 printk(KERN_NOTICE "pmc551: not detected\n");