[PATCH -next] drm/msm/adreno: Use kvmemdup to simplify the code

Akhil P Oommen quic_akhilpo at quicinc.com
Thu Aug 22 20:37:14 UTC 2024


On Wed, Aug 21, 2024 at 09:21:34AM +0800, Li Zetao wrote:
> Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.
> 
> No functional change intended.
> 
> Signed-off-by: Li Zetao <lizetao1 at huawei.com>

Reviewed-by: Akhil P Oommen <quic_akhilpo at quicinc.com>

-Akhil

> ---
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 1c6626747b98..ef473ac88159 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -688,11 +688,9 @@ int adreno_gpu_state_get(struct msm_gpu *gpu, struct msm_gpu_state *state)
>  				size = j + 1;
>  
>  		if (size) {
> -			state->ring[i].data = kvmalloc(size << 2, GFP_KERNEL);
> -			if (state->ring[i].data) {
> -				memcpy(state->ring[i].data, gpu->rb[i]->start, size << 2);
> +			state->ring[i].data = kvmemdup(gpu->rb[i]->start, size << 2, GFP_KERNEL);
> +			if (state->ring[i].data)
>  				state->ring[i].data_size = size << 2;
> -			}
>  		}
>  	}
>  
> -- 
> 2.34.1
> 
> 


More information about the dri-devel mailing list