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
1616 @r2 depends on patch@
1717 expression E;
1818 @@
19−- if (E)
19+- if (E != NULL)
2020 (
21−- kfree(E);
22−+ kfree(E);
21+ kfree(E);
2322 |
24−- debugfs_remove(E);
25−+ debugfs_remove(E);
23+ debugfs_remove(E);
2624 |
27−- debugfs_remove_recursive(E);
28−+ debugfs_remove_recursive(E);
25+ debugfs_remove_recursive(E);
2926 |
30−- usb_free_urb(E);
31−+ usb_free_urb(E);
27+ usb_free_urb(E);
3228 )
3329
3430 @r depends on context || report || org @
@@ -36,8 +32,8 @@ expression E; · 1 unmodified line
3632 position p;
3733 @@
3834
39−* if (E)
40−* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E);
35+* if (E != NULL)
36+* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb@p\)(E);
4137
4238 @script:python depends on org@
4339 p << r.p;