From patchwork Thu May 19 11:11:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Falak R Wani X-Patchwork-Id: 9126531 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3A3779F1C3 for ; Thu, 19 May 2016 11:22:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A3A4201FE for ; Thu, 19 May 2016 11:22:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 565802021F for ; Thu, 19 May 2016 11:22:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 009536E96E; Thu, 19 May 2016 11:22:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90C4B6E0D0 for ; Thu, 19 May 2016 11:12:09 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id g132so7818712pfb.3 for ; Thu, 19 May 2016 04:12:09 -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; bh=m4Y5ba6ZQ5/9Wx8FQZKRbsaYO/fbYYekzEer+bNGYwo=; b=XD6RO8rjuVH6pvURpkEVwnybAcD3FdgZJuasTZ+Los7WPrjdwthhocvbcim6sgtunX JV8Pe/ZV1L1SSaJnsfp58vYBXWkcfLR7bfoCsIL64gbpqLD7ASQlvA8vurnz4S09x/Hm Cr/HFN5H9grN6VkA6MQFoKnRkzQphSw2DJYfmknrU2coq3LuiH71f2v6OeW8yTDHooFm kWdB05qNWgE83q34ryExBrWKpZhJXYkZWA8gK4YncXVq5Cm7jCUg8L4+qohww7zqzN+s ACjv2es6cnSRqDcKJC2VPDIgPyT2uTGxuLqYhBcLvyakq7hppIHAvhGy/db2ZrVll7iI yCkA== 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; bh=m4Y5ba6ZQ5/9Wx8FQZKRbsaYO/fbYYekzEer+bNGYwo=; b=ag2S6g67yqssrNPR7pk+2NXfxRq++WZo79MWNjGzM1azAjmLIdcPldo7qqlNfYZNhQ 77SuUz0jO269nBT0dgYOIglYDv7hcweW37LVxYo5FyIwlUtdUOIUMZWWcyOiydJtIhAU Hgj2eiKLEqDZkcGBwDP3BmlciOtFTxNzdobaiwy6ujqtzb1tdkwtrAhLIrlzp6CdFmn5 dHEzlz/IaNNMKDVt5sbzaHtWdJjsUCbHrZjCR/9iFMvQvhaNBvKtNOgAJixHBu2fPGJL ofLfy+SYRcG6Eipa4XafNdmwuzxGu/msbEkqIokJIHFdHpHr+OR2An/pUWT8qXgOtpuB Hpow== X-Gm-Message-State: AOPr4FW6jW7f/O7e93MwsymNquFFYqC6Ar5z7AfaUsHqUUdIAWF4+Hy06t/5WlauUUVU5g== X-Received: by 10.98.88.4 with SMTP id m4mr18515357pfb.71.1463656328892; Thu, 19 May 2016 04:12:08 -0700 (PDT) Received: from kp.domain.name ([110.235.28.83]) by smtp.gmail.com with ESMTPSA id a5sm19127254pat.19.2016.05.19.04.12.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 04:12:08 -0700 (PDT) From: Muhammad Falak R Wani To: David Airlie Subject: [PATCH] amdgpu/uvd: use kmemdup Date: Thu, 19 May 2016 16:41:45 +0530 Message-Id: <1463656317-13828-1-git-send-email-falakreyaz@gmail.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Thu, 19 May 2016 11:22:18 +0000 Cc: Jammy Zhou , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sonny Jiang , Alex Deucher , Leo Liu , =?UTF-8?q?Christian=20K=C3=B6nig?= 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }