[PATCH 4/8] drivers/amdgpu: Use kmemdup instead of kmalloc + memcpy

Christian König deathsimple at vodafone.de
Mon Jul 11 12:01:59 UTC 2016


Am 11.07.2016 um 09:11 schrieb Edward O'Callaghan:
> This replaces calls to kmalloc followed by memcpy with a single
> call to kmemdup.

The rest of the series is Reviewed-by: Christian König 
<christian.koenig at amd.com, but this patch here is a NAK.

We already had that discussion about 2 month ago. This memcpy() actually 
needs to be a memcpy_fromio() and yes fixing this is on my todo list for 
the past 2 month but I haven't found time to actually do it :(

Regards,
Christian.

>
> Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index d9c88d13..7cd0626 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
>   	size = amdgpu_bo_size(adev->uvd.vcpu_bo);
>   	ptr = adev->uvd.cpu_addr;
>   
> -	adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
> +	adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
>   	if (!adev->uvd.saved_bo)
>   		return -ENOMEM;
>   
> -	memcpy(adev->uvd.saved_bo, ptr, size);
> -
>   	return 0;
>   }
>   



More information about the amd-gfx mailing list