From patchwork Thu May 19 11:15:27 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: 9126521 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B3167BF29F for ; Thu, 19 May 2016 11:22:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7CAA20219 for ; Thu, 19 May 2016 11:22:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2EBF120172 for ; Thu, 19 May 2016 11:22:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6FE86E973; 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-pa0-x243.google.com (mail-pa0-x243.google.com [IPv6:2607:f8b0:400e:c03::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 01FF96E037 for ; Thu, 19 May 2016 11:15:52 +0000 (UTC) Received: by mail-pa0-x243.google.com with SMTP id yl2so7580532pac.1 for ; Thu, 19 May 2016 04:15:51 -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=vN31YgE2jDUA8O/YnVmjrpCTS1Nnea4vDuPRIUClkGA=; b=K1/abR3h0kLho0pw5/abIsT+VaM+nh9Idm/m5mgmd5UTtZZ8ykIJ93CDVmu1Kj5w7c FNq05Q0OEXA4PleZ0GLEyziaM5cBzNHoNz7e6hN3NMtFTFOEK/FSgwACS8eK8NkUeOzo KtkByMRx6qFelXeftmBnUNgTYs0ToXcFOw6fikF3mngdunKgkwzuluPFwSbudy9/eQzg CPflIrKSv58R+WdQI3v0J1tahmx99FsdKrWs/V+2qsSCxQUeZsBjPy6mZSiaqoYqVIS0 4pthyZd/g561mc5n3VdpSTQfYBwZkI+UUFWmC5o3m9XXY+kChWIr8T3wl0ZueToGGJjP Rrbw== 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=vN31YgE2jDUA8O/YnVmjrpCTS1Nnea4vDuPRIUClkGA=; b=fLgmrTj/gw7h8CcgUhEcpCZylvl9EDKDn2dfgG5Iz3pPMcyuOqQw7nGTd2AQImcFpj TEz2NE8FO8XSZ1/h2kG9mvemRl7FgFa+1APAWWy6NJNXk8E5CqxIjONG7BGY4l4Z9Hsw uy66+2HA3DCKZh16pqIBRf2XkMknhflsSbdTRZ6bhXeTEltANLWXIP0ogtEbT3QpVIiz 6xPL3CoHlzeiXtp3VehXR6nLo254v4G60rlDCnTfQEV6sfLsEuprr8JOYi1e7buqecNu jGoXET2AT+p4yUzWn6a8ax/T5DbKaXP+tducvQDJOMX5duUrjkJJvj3CcTpiXQbPUN+J hzbQ== X-Gm-Message-State: AOPr4FUtZoJ+S3MGg4QAhlgUda600W3WR+0UqenGL6rTxfRXJ8a/tg9BLgKRWzcG/8rvtg== X-Received: by 10.66.249.228 with SMTP id yx4mr18760104pac.29.1463656551347; Thu, 19 May 2016 04:15:51 -0700 (PDT) Received: from kp.domain.name ([110.235.28.83]) by smtp.gmail.com with ESMTPSA id u65sm19108166pfa.9.2016.05.19.04.15.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 04:15:50 -0700 (PDT) From: Muhammad Falak R Wani To: David Airlie Subject: [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Date: Thu, 19 May 2016 16:45:27 +0530 Message-Id: <1463656541-13931-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: =?UTF-8?q?Nils=20Wallm=C3=A9nius?= , Jammy Zhou , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Eric Huang , Alex Deucher , Rex Zhu , =?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/powerplay/hwmgr/fiji_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c index c94f9fa..1471ac3 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c @@ -5109,11 +5109,11 @@ static int fiji_get_pp_table(struct pp_hwmgr *hwmgr, char **table) struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend); if (!data->soft_pp_table) { - data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL); + data->soft_pp_table = kmemdup(hwmgr->soft_pp_table, + hwmgr->soft_pp_table_size, + GFP_KERNEL); if (!data->soft_pp_table) return -ENOMEM; - memcpy(data->soft_pp_table, hwmgr->soft_pp_table, - hwmgr->soft_pp_table_size); } *table = (char *)&data->soft_pp_table;