aboutsummaryrefslogtreecommitdiff
path: root/scripts/coccinelle/api/alloc
AgeCommit message (Collapse)AuthorFilesLines
2020-08-21coccinelle: add patch rule for dma_alloc_coherentAlex Dewar1-3/+13
Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()") removed the definition of dma_zalloc_coherent() and also removed the corresponding patch rule for replacing instances of dma_alloc_coherent + memset in zalloc-simple.cocci (though left the report rule). Add a new patch rule to remove unnecessary calls to memset after allocating with dma_alloc_coherent. While we're at it, fix a couple of typos. Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()") Signed-off-by: Alex Dewar <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505Thomas Gleixner3-6/+9
Based on 1 normalized pattern(s): gplv2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 58 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-08dma-mapping: remove dma_zalloc_coherent()Luis Chamberlain2-14/+5
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 <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2018-08-22Coccinelle: remove pci_alloc_consistent semantic to detect in ↵zhong jiang1-40/+1
zalloc-simple.cocci Because pci_alloc_consistent has been deprecated. We prefer to use dma_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent to increase the confidence. Acked-by: Julia Lawall <[email protected]> Acked-by: Himanshu Jha <[email protected]> Signed-off-by: zhong jiang <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
2018-01-16Coccinelle: kzalloc-simple: Rename kzalloc-simple to zalloc-simpleHimanshu Jha1-0/+0
Rename kzalloc-simple to zalloc-simple since now the rule is not specific to kzalloc function only, but also to many other zero memory allocating functions specified in the rule. Suggested-by: SF Markus Elfring <[email protected]> Signed-off-by: Himanshu Jha <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
2018-01-16Coccinelle: alloc_cast: Add more memory allocating functions to the listHimanshu Jha1-21/+71
Add more memory allocating functions that are frequently used in the kernel code to the existing list and remove the useless casts where it is unnecessary. But preserve those casts having __attribute__ such as __force, __iomem, etc. which are used by Sparse in the static analysis of the code. Also remove two blank lines at EOF. Signed-off-by: Himanshu Jha <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
2018-01-16Coccinelle: kzalloc-simple: Add all zero allocating functionsHimanshu Jha1-5/+367
There are many instances where memory is allocated using regular allocator functions immediately followed by setting the allocated memory to 0 value using memset. We already have zero memory allocator functions to set the memory to 0 value instead of manually setting it using memset. Therefore, use zero memory allocating functions instead of regular memory allocators followed by memset 0 to remove redundant memset and make the code more cleaner and also reduce the code size. Signed-off-by: Himanshu Jha <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
2015-09-08coccinelle: mm: scripts/coccinelle/api/alloc/pool_zalloc-simple.cocciSean O. Stalley1-0/+84
add [pci|dma]_pool_zalloc coccinelle check. replaces instances of [pci|dma]_pool_alloc() followed by memset(0) with [pci|dma]_pool_zalloc(). Signed-off-by: Sean O. Stalley <[email protected]> Acked-by: Julia Lawall <[email protected]> Cc: Vinod Koul <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Gilles Muller <[email protected]> Cc: Nicolas Palix <[email protected]> Cc: Michal Marek <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-08-06Coccinelle: Script to detect cast after memory allocationHimangi Saraogi2-67/+72
This script detects cases of use of cast for the value returned by kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc, kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes the cast as it is not useful. This Coccinelle script replaces drop_kmalloc_cast.cocci as it removes the casting in more limited cases of kmalloc, kzalloc and kcalloc. Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Michal Marek <[email protected]>
2013-07-03Coccinelle: Update the options used to the new option schemeNicolas Palix2-2/+2
spatch has changed its option scheme. E.g., --no_show_diff is now --no-show-diff This patch updates: - scripts/coccicheck - Semantic patches under scripts/coccinelle/ Signed-off-by: Nicolas Palix <[email protected]> Signed-off-by: Michal Marek <[email protected]>
2010-08-31Coccinelle: Move alloc directory into api directoryNicolas Palix2-0/+153
alloc contains various semantic patches related to the allocation APIs Signed-off-by: Nicolas Palix <[email protected]> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Michal Marek <[email protected]>