linux/drivers/mtd
Julia Lawall d947629891 [MTD] [NAND] drivers/mtd/nand/pasemi_nand.c: Add missing pci_dev_put
pci_get_device increments a reference count that should be decremented
using pci_dev_put.

The semantic patch that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S,S1;
position p1,p2,p3;
expression E,E1;
type T,T1;
expression *ptr != NULL;
@@

(
 if ((x@p1 = pci_get_device(...)) == NULL) S
|
 x@p1 = pci_get_device(...);
)
 ... when != pci_dev_put(...,(T)x,...)
     when != if (...) { <+... pci_dev_put(...,(T)x,...) ...+> }
     when != true x == NULL || ...
     when != x = E
     when != E = (T)x
     when any
(
 if (x == NULL || ...) S1
|
 if@p2 (...) {
  ... when != pci_dev_put(...,(T1)x,...)
      when != if (...) { <+... pci_dev_put(...,(T1)x,...) ...+> }
      when != x = E1
      when != E1 = (T1)x
(
  return \(0\|<+...x...+>\|ptr\);
|
  return@p3 ...;
)
}
)

@ script:python @
p1 << r.p1;
p3 << r.p3;
@@

print "* file: %s pci_get_device: %s return: %s" % (p1[0].file,p1[0].line,p3[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-12-02 10:45:19 +00:00
..
chips [MTD] [NOR] Fix cfi_send_gen_cmd handling of x16 devices in x8 mode (v4) 2008-11-05 14:40:25 +01:00
devices [MTD] m25p80: chip erase != block erase != sector erase 2008-11-26 10:24:27 +00:00
maps [MTD] physmap: fix memory leak on physmap_flash_remove by using devres 2008-11-26 10:26:29 +00:00
nand [MTD] [NAND] drivers/mtd/nand/pasemi_nand.c: Add missing pci_dev_put 2008-12-02 10:45:19 +00:00
onenand [MTD] [NAND] OMAP: OneNAND: header file relocation (part 2) 2008-11-26 10:08:13 +00:00
ubi UBI: print reserved_peb when it is too large 2008-10-09 16:19:04 +03:00
afs.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
ar7part.c [MTD] Clean up AR7 partition map support 2008-04-23 09:39:49 +01:00
cmdlinepart.c [MTD] cmdlineparts documentation change - explain where mtd-id comes from 2008-10-18 12:43:03 +01:00
ftl.c Support 'discard sectors' operation. 2008-10-09 08:56:01 +02:00
inftlcore.c [MTD] [INFTL] Fix infinite loop in INFTL_foldchain 2008-10-08 11:26:38 +01:00
inftlmount.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
Kconfig [MTD] dataflash OTP support 2008-08-01 21:47:47 +01:00
Makefile [MTD] AR7 mtd partition map 2008-04-22 20:48:12 +01:00
mtd_blkdevs.c Support 'discard sectors' operation in translation layer support core 2008-10-09 08:56:01 +02:00
mtdblock_ro.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
mtdblock.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
mtdchar.c Merge git://git.infradead.org/mtd-2.6 2008-10-20 09:03:12 -07:00
mtdconcat.c [MTD] Define and use MTD_FAIL_ADDR_UNKNOWN instead of 0xffffffff 2008-08-12 11:02:15 +01:00
mtdcore.c [MTD] Use list_for_each_entry[_safe] where appropriate. 2008-06-04 17:53:31 +01:00
mtdcore.h [MTD] mtdcore.c: share syms with mtd_blkdev.c 2007-06-28 20:24:50 +01:00
mtdoops.c [MTD] mtdoops: Fix a bug where block may not be erased 2008-10-18 11:51:48 +01:00
mtdpart.c Merge git://git.infradead.org/mtd-2.6 2008-10-20 09:03:12 -07:00
mtdsuper.c [MTD] Fix !CONFIG_BLOCK compile for mtdsuper.c 2008-08-02 07:52:39 +01:00
nftlcore.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
nftlmount.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
ofpart.c [MTD] remove unused mtd parameter in of_mtd_parse_partitions() 2008-10-13 15:01:42 +01:00
redboot.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-07-11 14:36:25 +01:00
rfd_ftl.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
ssfdc.c [MTD] Use DIV_ROUND_UP 2008-08-02 18:45:18 +01:00