aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/api/alloc/zalloc-simple.cocci
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2018-12-19 12:30:34 -0800
committerChristoph Hellwig <hch@lst.de>2019-01-08 07:58:49 -0500
commitdfd32cad146e3624970eee9329e99d2c6ef751b3 (patch)
tree7d72650db6c1fe3ee4122edccc0af7b1b264e369 /scripts/coccinelle/api/alloc/zalloc-simple.cocci
parentcross-tree: phase out dma_zalloc_coherent() on headers (diff)
downloadlinux-dev-dfd32cad146e3624970eee9329e99d2c6ef751b3.tar.xz
linux-dev-dfd32cad146e3624970eee9329e99d2c6ef751b3.zip
dma-mapping: remove dma_zalloc_coherent()
dma_zalloc_coherent() is no longer needed as it has no users because dma_alloc_coherent() already zeroes out memory for us. The Coccinelle grammar rule that used to check for dma_alloc_coherent() + memset() is modified so that it just tells the user that the memset is not needed anymore. Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to '')
-rw-r--r--scripts/coccinelle/api/alloc/zalloc-simple.cocci11
1 files changed, 1 insertions, 10 deletions
diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index d819275b7fde..5cd1991c582e 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -69,15 +69,6 @@ statement S;
- x = (T)vmalloc(E1);
+ x = (T)vzalloc(E1);
|
-- x = dma_alloc_coherent(E2,E1,E3,E4);
-+ x = dma_zalloc_coherent(E2,E1,E3,E4);
-|
-- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
-+ x = dma_zalloc_coherent(E2,E1,E3,E4);
-|
-- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
-+ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
-|
- x = kmalloc_node(E1,E2,E3);
+ x = kzalloc_node(E1,E2,E3);
|
@@ -225,7 +216,7 @@ p << r2.p;
x << r2.x;
@@
-msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
+msg="WARNING: dma_alloc_coherent use in %s already zeroes out memory, so memset is not needed" % (x)
coccilib.report.print_report(p[0], msg)
//-----------------------------------------------------------------