diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2015-10-26 22:28:25 +0100 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2015-10-26 22:41:13 +0100 |
commit | ca047e715c638eacf58cb830c3ef36cecc45c3f8 (patch) | |
tree | 3310195534b9f211a88a322f6937efde527aec00 /scripts/coccinelle/free | |
parent | 41167d072b8626ed14e80241c71beb99ac65db53 (diff) | |
download | blackbird-obmc-linux-ca047e715c638eacf58cb830c3ef36cecc45c3f8.tar.gz blackbird-obmc-linux-ca047e715c638eacf58cb830c3ef36cecc45c3f8.zip |
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.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/coccinelle/free')
-rw-r--r-- | scripts/coccinelle/free/ifnullfree.cocci | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci index a42d70bf88b3..d4a072d5b505 100644 --- a/scripts/coccinelle/free/ifnullfree.cocci +++ b/scripts/coccinelle/free/ifnullfree.cocci @@ -16,19 +16,15 @@ virtual context @r2 depends on patch@ expression E; @@ -- if (E) +- if (E != NULL) ( -- kfree(E); -+ kfree(E); + kfree(E); | -- debugfs_remove(E); -+ debugfs_remove(E); + debugfs_remove(E); | -- debugfs_remove_recursive(E); -+ debugfs_remove_recursive(E); + debugfs_remove_recursive(E); | -- usb_free_urb(E); -+ usb_free_urb(E); + usb_free_urb(E); ) @r depends on context || report || org @ @@ -36,8 +32,8 @@ expression E; position p; @@ -* if (E) -* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E); +* if (E != NULL) +* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb@p\)(E); @script:python depends on org@ p << r.p; |