diff options
| author | Luis Chamberlain <mcgrof@kernel.org> | 2018-12-19 15:30:34 -0500 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2019-01-08 07:58:49 -0500 |
| commit | dfd32cad146e3624970eee9329e99d2c6ef751b3 (patch) | |
| tree | 7d72650db6c1fe3ee4122edccc0af7b1b264e369 /scripts/coccinelle/api/alloc/zalloc-simple.cocci | |
| parent | 07a85fe14254e01bcf37f4d2e0a13f093378620b (diff) | |
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 'scripts/coccinelle/api/alloc/zalloc-simple.cocci')
| -rw-r--r-- | scripts/coccinelle/api/alloc/zalloc-simple.cocci | 11 |
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; | |||
| 69 | - x = (T)vmalloc(E1); | 69 | - x = (T)vmalloc(E1); |
| 70 | + x = (T)vzalloc(E1); | 70 | + x = (T)vzalloc(E1); |
| 71 | | | 71 | | |
| 72 | - x = dma_alloc_coherent(E2,E1,E3,E4); | ||
| 73 | + x = dma_zalloc_coherent(E2,E1,E3,E4); | ||
| 74 | | | ||
| 75 | - x = (T *)dma_alloc_coherent(E2,E1,E3,E4); | ||
| 76 | + x = dma_zalloc_coherent(E2,E1,E3,E4); | ||
| 77 | | | ||
| 78 | - x = (T)dma_alloc_coherent(E2,E1,E3,E4); | ||
| 79 | + x = (T)dma_zalloc_coherent(E2,E1,E3,E4); | ||
| 80 | | | ||
| 81 | - x = kmalloc_node(E1,E2,E3); | 72 | - x = kmalloc_node(E1,E2,E3); |
| 82 | + x = kzalloc_node(E1,E2,E3); | 73 | + x = kzalloc_node(E1,E2,E3); |
| 83 | | | 74 | | |
| @@ -225,7 +216,7 @@ p << r2.p; | |||
| 225 | x << r2.x; | 216 | x << r2.x; |
| 226 | @@ | 217 | @@ |
| 227 | 218 | ||
| 228 | msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x) | 219 | msg="WARNING: dma_alloc_coherent use in %s already zeroes out memory, so memset is not needed" % (x) |
| 229 | coccilib.report.print_report(p[0], msg) | 220 | coccilib.report.print_report(p[0], msg) |
| 230 | 221 | ||
| 231 | //----------------------------------------------------------------- | 222 | //----------------------------------------------------------------- |
