lkml.org 
[lkml]   [2021]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] swiotlb: fix alloc_cast.cocci warnings
From: kernel test robot <lkp@intel.com>

kernel/dma/swiotlb.c:389:15-33: WARNING: casting value returned by memory allocation function to (struct io_tlb_area *) is useless.

Remove casting the values returned by memory allocation functions
like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.

Semantic patch information:
This makes an effort to find cases of casting of values returned by
kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
the casting as it is not required. The result in the patch case may
need some reformatting.

Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci

Fixes: 4529b5784c14 ("swiotlb: Split up single swiotlb lock")
CC: Andi Kleen <ak@linux.intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree: https://github.com/intel/tdx.git guest
head: 41fe88a1b3c28543f49fa6ed9e0e9b6650ed7614
commit: 4529b5784c141782c72ec9bd9a92df2b68cb7d45 [129/144] swiotlb: Split up single swiotlb lock
:::::: branch date: 9 days ago
:::::: commit date: 9 days ago

swiotlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -386,7 +386,7 @@ swiotlb_late_init_with_tbl(char *tlb, un
return -ENOMEM;
}

- mem->areas = (struct io_tlb_area *)kcalloc(num_areas,
+ mem->areas = kcalloc(num_areas,
sizeof(struct io_tlb_area),
GFP_KERNEL);
if (!mem->areas) {
\
 
 \ /
  Last update: 2021-11-20 09:35    [W:0.264 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site