Skip to content

Commit

Permalink
coccinelle: ifnullfree: various cleanups
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Michal Marek committed Oct 26, 2015
1 parent 41167d0 commit ca047e7
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions scripts/coccinelle/free/ifnullfree.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,24 @@ 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 @
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;
Expand Down

0 comments on commit ca047e7

Please sign in to comment.