diff mbox

drm/amd/display: fix alloc_cast.cocci warnings

Message ID 20171006205613.GA54186@lkp-sbx04 (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu Oct. 6, 2017, 8:56 p.m. UTC
drivers/gpu/drm/amd/amdgpu/../display/dc/basics/logger.c:73:23-27: WARNING: casting value returned by memory allocation function to (char *) 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: 2004f45ef83f ("drm/amd/display: Use kernel alloc/free")
CC: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

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

Patch

--- a/drivers/gpu/drm/amd/amdgpu/../display/dc/basics/logger.c
+++ b/drivers/gpu/drm/amd/amdgpu/../display/dc/basics/logger.c
@@ -70,7 +70,7 @@  static bool construct(struct dc_context
 {
 	/* malloc buffer and init offsets */
 	logger->log_buffer_size = DAL_LOGGER_BUFFER_MAX_SIZE;
-	logger->log_buffer = (char *)kzalloc(logger->log_buffer_size * sizeof(char),
+	logger->log_buffer = kzalloc(logger->log_buffer_size * sizeof(char),
 					     GFP_KERNEL);
 
 	if (!logger->log_buffer)