1 /// Find missing pci_free_consistent for every pci_alloc_consistent.
3 // Confidence: Moderate
4 // Copyright: (C) 2013 Petr Strnad. GPLv2.
5 // URL: http://coccinelle.lip6.fr/
6 // Keywords: pci_free_consistent, pci_alloc_consistent
7 // Options: --no-includes --include-headers
13 local idexpression id;
19 id = pci_alloc_consistent@p1(x,y,&z)
21 if (id == NULL || ...) { ... return ...; }
22 ... when != pci_free_consistent(x,y,id,z)
23 when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
24 when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
37 @script:python depends on report@
42 msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
43 coccilib.report.print_report(p2[0],msg)
45 @script:python depends on org@
50 msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
51 cocci.print_main(msg,p1)
52 cocci.print_secs("",p2)