From patchwork Thu Jul 28 16:18:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9251819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18B736077C for ; Fri, 29 Jul 2016 00:35:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A67C27EED for ; Fri, 29 Jul 2016 00:35:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2D8427F85; Fri, 29 Jul 2016 00:35:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B26C127EED for ; Fri, 29 Jul 2016 00:35:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D5206E8E2; Fri, 29 Jul 2016 00:35:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 85BCE6E86B for ; Thu, 28 Jul 2016 16:18:25 +0000 (UTC) Received: by mail-pf0-x242.google.com with SMTP id g202so3969757pfb.1 for ; Thu, 28 Jul 2016 09:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6qLO83bayzfuKrGGpp0Lg49sMqrk+nXUM1sRfSe8WxA=; b=JNAD4fbhh7FShfLhuGehdiYDfK516BDNmHew46rAFtCXK5VAFjKz6d3Dk/abWXlibl XKd0X9rIlVtp+L3IzI9meTXtKVuhuhv/oYPeZreMAB+iOEr4DK9NylSzrebEgcNpt9+U jcWlB7ZYp9qzBBod/GzqrquXGBXWwrSYthGJYm+OCeZFe3dtb5zwoyv+AtKJeUlS+hWM fSpcueKt93HNrjvxFAoZtSA7Aa6Cs3WDlDAcE1p9ALhKcHmc/yPyi5a6M1MDiFng/h8G +53PircweCrYhIgz6/jqCpXvYm30WMI/S1dhfYsP3l2WzAY7zHeMB/3pED8XS7HjsWo9 iJTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6qLO83bayzfuKrGGpp0Lg49sMqrk+nXUM1sRfSe8WxA=; b=kIvfhtpYd7XEOv8ZuDHvsLYBxHWcpkibpRMYsp3NOuqS6qmxyj+Bbkk469Aj3gWhbQ Ww59zJXsQL3itR186WXGcMi7kbKHBjfBarpNZ76eXJn+yho0fWISLuu5b20OOZm0wEmo 0FfstbqhjNBvf3wwzKpo4piavXg6Nl9hGNhQmc2W8s6sBIljHME6qDRM3ZnW3EHkpLkv NoGb5CZwgF3OGtY6Y5P6MRGu3tz+YhkUoiXIe//2lK/xyxWIgLuGLyMzFJzcpLg/OcWE +VLMemr8vFN9ZW3bQgOBglNTABMEo5E9g9rFm4IeK8nTdLJX/MStvxllydR/H5wst3o7 rhmQ== X-Gm-Message-State: AEkoouu1drbImSLjR4WDdb2XMO+GUyP4mWEUjkpmJIbpIUwgr74r4w98MEH2zdDMrp2PbQ== X-Received: by 10.98.11.133 with SMTP id 5mr60051066pfl.160.1469722704085; Thu, 28 Jul 2016 09:18:24 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id s89sm18249166pfi.83.2016.07.28.09.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 09:18:23 -0700 (PDT) From: Wei Yongjun To: Alex Deucher , 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 Subject: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation Date: Thu, 28 Jul 2016 16:18:17 +0000 Message-Id: <1469722697-15220-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 29 Jul 2016 00:35:05 +0000 Cc: Wei Yongjun , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use kmemdup rather than duplicating its implementation. Generated by: scripts/coccinelle/api/memdup.cocci Signed-off-by: Wei Yongjun Acked-by: Sean Paul --- 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; }