[PATCH] drm/amdgpu: fix alloc_cast.cocci warnings
kbuild test robot
fengguang.wu at intel.com
Sat Nov 5 05:48:50 UTC 2016
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1225:10-29: WARNING: casting value returned by memory allocation function to (struct dma_fence * *) 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
CC: Junwei Zhang <Jerry.Zhang at amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
---
amdgpu_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1222,7 +1222,7 @@ static int amdgpu_cs_wait_any_fence(stru
long r;
/* Prepare the fence array */
- array = (struct dma_fence **)kcalloc(fence_count, sizeof(struct dma_fence *),
+ array = kcalloc(fence_count, sizeof(struct dma_fence *),
GFP_KERNEL);
if (array == NULL)
return -ENOMEM;
More information about the dri-devel
mailing list