All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyj.lk@gmail.com>
To: Alex Deucher <alexander.deucher@amd.com>,
	christian.koenig@amd.com, airlied@linux.ie, sonny.jiang@amd.com,
	leo.liu@amd.com, arindam.nath@amd.com, David1.Zhou@amd.com,
	Jammy.Zhou@amd.com, Monk.Liu@amd.com
Cc: Wei Yongjun <weiyj.lk@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation
Date: Thu, 28 Jul 2016 16:18:17 +0000	[thread overview]
Message-ID: <1469722697-15220-1-git-send-email-weiyj.lk@gmail.com> (raw)

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;
 }
 

             reply	other threads:[~2016-07-28 16:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 16:18 Wei Yongjun [this message]
2016-07-29 19:35 ` [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation Sean Paul
2016-07-29 19:38   ` Deucher, Alexander
2016-07-29 19:38     ` Deucher, Alexander
2016-07-29 19:40     ` Sean Paul
2016-08-01 12:16     ` Nicolai Hähnle
2016-08-01 12:16       ` Nicolai Hähnle
2016-08-02 13:37       ` Christian König
2016-08-02 13:37         ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469722697-15220-1-git-send-email-weiyj.lk@gmail.com \
    --to=weiyj.lk@gmail.com \
    --cc=David1.Zhou@amd.com \
    --cc=Jammy.Zhou@amd.com \
    --cc=Monk.Liu@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=arindam.nath@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=leo.liu@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sonny.jiang@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.