[PATCH] drm/amdgpu: fix alloc_cast.cocci warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
---

 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;
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux