Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4156854pxb; Tue, 10 Nov 2020 09:13:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdg7sYtmhO3PuKO2ocxM7glRGUAMiFZ2Mb4MhCOyHXoWLllinDqpVDPmehfQqnlNpRtI8s X-Received: by 2002:a17:906:d20e:: with SMTP id w14mr20563014ejz.479.1605028387329; Tue, 10 Nov 2020 09:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605028387; cv=none; d=google.com; s=arc-20160816; b=fCfH61MnVVCICioEAcueJfxyRPtagh8NvcRhtTF4jH+iR/hFBJJHGR+ZN04rqyfTbB QFqJukJ4EGfl1CldUojQ8MIktuBGVXSpV4NXVgIIgUfnrlo3PVCif0j+v/8D10t5kJMX 567NKUKJpg7Jbh+LFNXp6GkWSaRX+6MR9pu1lC/FSbKrHGfT5jnDCqr69pQO2+Wb0GZj d3/6nGxGNaBKFL6f234gVanIXx25nIAlJ/GQOJjFXl2l3766PXDLq0Ec24CqEmoTkb3S ACVeYn2tLcYahfdrZ2SDfs0/rEalUXby3EV/Yj146uMXwsYGWQ2DxWpBbpyiujPrMBtP fpoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MP7B63t+yoSacKBIptO0FK7JGIG1SuX3J5XEKrv0R1g=; b=m9dQjcjg3LbYWHFDr1mB4XEGvAFvGdfIaai7VGC83K5sey4ATQfGDFCc001UfTVbIe TNYo2j06GPtTBmrXubb9YlWJqJBEzqHctqeI+aUx6yWa9luY+JnxnWworID/ml5qiJAP f/i/nEWVH4qyoVqQolclOau8vhONFdoHIoaEXlDwMP1mIOVVlDONnSrM0VN1Uq+c50Tc VKtcCD3OffKaNXwfrEO8HVippebz+vIlPWdTA3XjdIRRPgbHZoAC4eS3+f+AqXf9K9SV QJWz2kLavOxZnO7oCsy/DcX7ebIlMlHHwlv4iZ09eCJCq1UBAhneH1Jl1W173+in+YZ2 Z4JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=D9I8wAmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x15si9631449ejf.349.2020.11.10.09.12.44; Tue, 10 Nov 2020 09:13:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=D9I8wAmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730681AbgKJRIW (ORCPT + 99 others); Tue, 10 Nov 2020 12:08:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgKJRIV (ORCPT ); Tue, 10 Nov 2020 12:08:21 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71B38C0613CF for ; Tue, 10 Nov 2020 09:08:21 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id d142so3835520wmd.4 for ; Tue, 10 Nov 2020 09:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MP7B63t+yoSacKBIptO0FK7JGIG1SuX3J5XEKrv0R1g=; b=D9I8wAmHqyj+i4Uu96Y3bxWuJs3MnB2WC/JIbN6DbaOyTMwPBbA8ODwB52W4GvoAvb xjwHAsANSAGGzyuDDR2ls0rUkeKCWRxVeGD2mQ7+87wnFJY1f1Xj7q8BEKXwyOsggHqj /jOye5LWn2xuMbLaJXVBSRRIK/x1KzVpyGXSft/jLaN+nvChjCPfUezvtfph5j3Tpfxo hyNOdkuc7/0CG1lFxptmNQHEAIg4rGEVXTdauIOMcqOYTucImAz69W92OP7Q39DUWOL+ a/qheGe2KBsQ6aKDhC2R3Ww4LoiShOAxnyTBR93S5YVs59wd+vD68cE3Cg5g0VY5Hiyx F1Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MP7B63t+yoSacKBIptO0FK7JGIG1SuX3J5XEKrv0R1g=; b=XaOQsVO9nvNe5Y3hzLpyE3Umfb/+aSWr7tZhSHHxucfBw2AWnWKW6iEAfbuersGf3c McN8zvvvr39WT3q38/82oX7iMUqg9QlC8knbKIaUP2+sJ8AlaN5aZCwIC9NTQ+iL/4V8 uaAfaq21wITHGmMGDOz2d+FjwgE2baHt+gUColeqDjkNEGWJFdXKKvGO+cPIjqwssuRn 3ykpIdsA73SlW6jhm2AlEe1WG7yLaJ7R+F+UWIMRe5BgW/FJQaxrV7lsqiOXq1b00r7M AcJXnRZLZXJEyW62a8512udNqu5gmcpGiJwM4NhDLM0IEiY8j7iCdtqoB7IvxN6vQr8u qJpg== X-Gm-Message-State: AOAM532PcD86EFo4S6DgRrXrAUtbBa1e6ohWxgZZQtXQD1747N8xkY8d wnxDHQZEyWGbXcbaINwHri8kpVzt4bVUfWgVX+4= X-Received: by 2002:a1c:80cb:: with SMTP id b194mr42687wmd.73.1605028100187; Tue, 10 Nov 2020 09:08:20 -0800 (PST) MIME-Version: 1.0 References: <1605008098-33391-1-git-send-email-tiantao6@hisilicon.com> In-Reply-To: <1605008098-33391-1-git-send-email-tiantao6@hisilicon.com> From: Alex Deucher Date: Tue, 10 Nov 2020 12:08:08 -0500 Message-ID: Subject: Re: [PATCH] drm/amd/pm: Use kmemdup instead of kmalloc and memcpy To: Tian Tao Cc: "Quan, Evan" , "Deucher, Alexander" , Christian Koenig , Dave Airlie , Daniel Vetter , Alex Dewar , Nirmoy Das , amd-gfx list , Maling list - DRI developers , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 11:57 AM Tian Tao wrote: > > Fixes coccicheck warning: > drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c:255: > 36-43: WARNING opportunity for kmemdup > > Signed-off-by: Tian Tao Applied. Thanks! Alex > --- > drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c > index 740e2fc..1e79baa 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c > @@ -252,12 +252,11 @@ static int init_powerplay_table_information( > phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_max, powerplay_table->PowerSavingClockMax, ATOM_VEGA12_PPCLOCK_COUNT); > phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_min, powerplay_table->PowerSavingClockMin, ATOM_VEGA12_PPCLOCK_COUNT); > > - pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), GFP_KERNEL); > + pptable_information->smc_pptable = kmemdup(&(powerplay_table->smcPPTable), > + sizeof(PPTable_t), GFP_KERNEL); > if (pptable_information->smc_pptable == NULL) > return -ENOMEM; > > - memcpy(pptable_information->smc_pptable, &(powerplay_table->smcPPTable), sizeof(PPTable_t)); > - > result = append_vbios_pptable(hwmgr, (pptable_information->smc_pptable)); > > return result; > -- > 2.7.4 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx