diff options
| author | Julia Lawall <Julia.Lawall@lip6.fr> | 2015-10-26 17:28:25 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2015-10-26 17:41:13 -0400 |
| commit | ca047e715c638eacf58cb830c3ef36cecc45c3f8 (patch) | |
| tree | 3310195534b9f211a88a322f6937efde527aec00 | |
| parent | 41167d072b8626ed14e80241c71beb99ac65db53 (diff) | |
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>
| -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 | |||
| 16 | @r2 depends on patch@ | 16 | @r2 depends on patch@ |
| 17 | expression E; | 17 | expression 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; | |||
| 36 | position p; | 32 | position 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@ |
| 43 | p << r.p; | 39 | p << r.p; |
