linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation
@ 2016-07-28 16:18 Wei Yongjun
  2016-07-29 19:35 ` Sean Paul
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Yongjun @ 2016-07-28 16:18 UTC (permalink / raw)
  To: Alex Deucher, christian.koenig, airlied, sonny.jiang, leo.liu,
	arindam.nath, David1.Zhou, Jammy.Zhou, Monk.Liu
  Cc: Wei Yongjun, dri-devel, linux-kernel

Use kmemdup rather than duplicating its implementation.

Generated by: scripts/coccinelle/api/memdup.cocci

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
 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 a46a64c..b779b5f 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;
 }
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-02 13:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 16:18 [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation Wei Yongjun
2016-07-29 19:35 ` Sean Paul
2016-07-29 19:38   ` Deucher, Alexander
2016-07-29 19:40     ` Sean Paul
2016-08-01 12:16     ` Nicolai Hähnle
2016-08-02 13:37       ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).