History

coccinelle: ifnullfree: various cleanups

Adjust tests to compare against NULL, to match cases that explicitly make that comparison. Remove removal and re-addition of freeing functions. Add position variable on usb_free_urb in the non-patch case.

Julia Lawall committed 11 years ago

Commit ca047e71 parent 41167d01 file · +7 −11Browse files

Unified · Split

scripts/coccinelle/free/ifnullfree.cocci+7−11
@@ -16,19 +16,15 @@ virtual context · 15 unmodified lines
16@r2 depends on patch@16@r2 depends on patch@
17expression E;17expression E;
18@@18@@
19- if (E)19- if (E != NULL)
20(20(
21- kfree(E);21 kfree(E);
22+ kfree(E);
23|22|
24- debugfs_remove(E);23 debugfs_remove(E);
25+ debugfs_remove(E);
26|24|
27- debugfs_remove_recursive(E);25 debugfs_remove_recursive(E);
28+ debugfs_remove_recursive(E);
29|26|
30- usb_free_urb(E);27 usb_free_urb(E);
31+ usb_free_urb(E);
32)28)
33 29
34@r depends on context || report || org @30@r depends on context || report || org @
@@ -36,8 +32,8 @@ expression E; · 1 unmodified line
36position p;32position p;
37@@33@@
38 34
39* if (E)35* if (E != NULL)
40* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E);36* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb@p\)(E);
41 37
42@script:python depends on org@38@script:python depends on org@
43p << r.p;39p << r.p;