Re: [PATCH] amdgpu/uvd: use kmemdup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 19.05.2016 um 13:11 schrieb Muhammad Falak R Wani:
Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@xxxxxxxxx>

NAK, actually using memcpy() is wrong in the first place.

The UVD BO is in VRAM so the pointer is pointing to IO memory here, so this should be memcpy_fromio() instead of memcpy().

Christian.

---
  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 01abfc2..c977ab6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -295,12 +295,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;
  }

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux