diff mbox

drm/amdgpu: fix alloc_cast.cocci warnings

Message ID 20161105054850.GA44302@lkp-sb04.lkp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu Nov. 5, 2016, 5:48 a.m. UTC
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@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 amdgpu_cs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

--- 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;