[PATCH v3] drm/amd/display: Remove unnecessary casts in amdgpu_dm_helpers.c

Christian König ckoenig.leichtzumerken at gmail.com
Mon Jun 26 15:18:32 UTC 2023


Am 26.06.23 um 14:43 schrieb Srinivasan Shanmugam:
> Fixes the following category of checkpatch complaints:
>
> WARNING: unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html
> +               char *buf = (char *)kvcalloc(total, sizeof(char), GFP_KERNEL);
>
> Cc: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>
> v3:
>   - Keeping same as v1 - so that variable "buf" remains to local to the block,
>     whereever it is declared, by having just removed the casting.
>
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> index cd20cfc04996..4590deca25f8 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> @@ -400,7 +400,7 @@ void dm_dtn_log_append_v(struct dc_context *ctx,
>   	total = log_ctx->pos + n + 1;
>   
>   	if (total > log_ctx->size) {
> -		char *buf = (char *)kvcalloc(total, sizeof(char), GFP_KERNEL);
> +		char *buf = kvcalloc(total, sizeof(char), GFP_KERNEL);
>   
>   		if (buf) {
>   			memcpy(buf, log_ctx->buf, log_ctx->pos);



More information about the amd-gfx mailing list