From patchwork Thu May 19 11:15:29 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: 9126501 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 63C799F1C3 for ; Thu, 19 May 2016 11:22:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85D1D20219 for ; Thu, 19 May 2016 11:22:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AF9E120172 for ; Thu, 19 May 2016 11:22:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CDA36E96A; Thu, 19 May 2016 11:22:19 +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 E69586E037 for ; Thu, 19 May 2016 11:16:32 +0000 (UTC) Received: by mail-pf0-x242.google.com with SMTP id y7so7831236pfb.0 for ; Thu, 19 May 2016 04:16:32 -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:in-reply-to:references; bh=XX/Vul61/7custz1VR5qFs9m/gAN1tHD+DRmR19ht3M=; b=gL0e+JUtX06TQpXGOFwByeH2uo7jHyEXf983ZmParubiNX09otcIIOS3oSLvzbRv5I 23+VBnGUuTqYVrwGR8XOalD9rNHmGDQ8QASJk2Ecfye6EWmeCeu5owZ/Ux6U/dlZI5/u UTR9fu8j2Wm9vz2txNJvhJSEG+wEdiCx4W4jcbMW2LlpQahFrY4jqitI5QvWrVt5juNn HqR4KtnVLf0aSYhV9iRo/+2fW9IUWfopWGuDyCCfpzZGCIP37n/vBT9Sg3E3r6OdCDrX svLBLanN2fQZuNa/OLomDRuzo6L75RqaykKRcX5/RfIjhJIf1lDgyK6+kEoFzihHkhHD KDxg== 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:in-reply-to :references; bh=XX/Vul61/7custz1VR5qFs9m/gAN1tHD+DRmR19ht3M=; b=YNmrRvtZTFJrw0a040mpEK32awlR55bD1L8Pvx/A9FWbhIwDQQvjmOLbz/+KvhY2x3 oRK7pk0DWqGHx/+eDQZUwcAxv3+/CNxiwfC1VHglOVP2tE3afyFZTz3grcFndxB2/1qf xUhlnPTgGQEIW6IRs1xhi6kihV9UNmkrmTorVH5kRRNLVdveLz9mIMH7JQr3zVyqG0U1 bmZr6eDPua/6HYYyvy09dFiMRR+tgr5qbFAOjYFxbD5ucFr0vPjkccGpjGWOtXKpxYBQ 7Zx11XGZms4EaddSEB78mYD9HtsVa/OzOBXeew47LkmGnW5wX7uDKE7mekH4DPQhqmUJ pMQQ== X-Gm-Message-State: AOPr4FVV7WbX4VHaVB5OhYh3PtWrpbWpzoGzc1GAbAOLlDRWfxdA4O06on4aucy+YbJYDg== X-Received: by 10.98.100.71 with SMTP id y68mr18920984pfb.84.1463656592360; Thu, 19 May 2016 04:16:32 -0700 (PDT) Received: from kp.domain.name ([110.235.28.83]) by smtp.gmail.com with ESMTPSA id u65sm19108166pfa.9.2016.05.19.04.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 04:16:12 -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:29 +0530 Message-Id: <1463656541-13931-3-git-send-email-falakreyaz@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463656541-13931-1-git-send-email-falakreyaz@gmail.com> References: <1463656541-13931-1-git-send-email-falakreyaz@gmail.com> 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 , =?UTF-8?q?Moritz=20K=C3=BChner?= , yanyang1 , 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=ham 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/tonga_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 1faad92..df399fe 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c @@ -6056,11 +6056,11 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table) struct tonga_hwmgr *data = (struct tonga_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;