summaryrefslogtreecommitdiffstats
path: root/kernel/scripts/coccinelle/free
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/scripts/coccinelle/free')
-rw-r--r--kernel/scripts/coccinelle/free/ifnullfree.cocci26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/scripts/coccinelle/free/ifnullfree.cocci b/kernel/scripts/coccinelle/free/ifnullfree.cocci
index a42d70bf8..52bd23528 100644
--- a/kernel/scripts/coccinelle/free/ifnullfree.cocci
+++ b/kernel/scripts/coccinelle/free/ifnullfree.cocci
@@ -16,19 +16,21 @@ 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);
+|
+ kmem_cache_destroy(E);
+|
+ mempool_destroy(E);
+|
+ dma_pool_destroy(E);
)
@r depends on context || report || org @
@@ -36,8 +38,10 @@ 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\|kmem_cache_destroy@p\|mempool_destroy@p\|
+* dma_pool_destroy@p\)(E);
@script:python depends on org@
p << r.p;