lkml.org 
[lkml]   [2015]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2 v2] coccinelle: ifnullfree: various cleanups
Date
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>

---
v2: better subject

scripts/coccinelle/free/ifnullfree.cocci | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
index a42d70b..d4a072d 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;


\
 
 \ /
  Last update: 2015-10-26 23:01    [W:0.023 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site