Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Julia Lawall and committed by
Michal Marek
ca047e71 41167d07

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