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@xxxxxxxxxx> Reviewed-by: Akhil P Oommen <quic_akhilpo@xxxxxxxxxxx> -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 > >