All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] drm/amd/pm: fix memdup.cocci warnings
Date: Mon, 05 Oct 2020 23:58:39 +0800	[thread overview]
Message-ID: <20201005155839.GA55183@076e3efa8c72> (raw)
In-Reply-To: <202010052312.zqjyXpyq-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Alex Dewar <alex.dewar90@gmail.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: "Christian König" <christian.koenig@amd.com>
CC: David Airlie <airlied@linux.ie>
CC: Daniel Vetter <daniel@ffwll.ch>
CC: Nirmoy Das <nirmoy.das@amd.com>
CC: Evan Quan <evan.quan@amd.com>
CC: amd-gfx(a)lists.freedesktop.org
CC: dri-devel(a)lists.freedesktop.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c:255:36-43: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: 4c319bbebef5 ("drm/amd/pm: Remove unnecessary cast")
CC: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2172e358cd1713c5b7c31361ac465edfe55e455c
commit: 4c319bbebef5491c1305d7b56e708f566f83d14a [2250/13159] drm/amd/pm: Remove unnecessary cast
:::::: branch date: 3 days ago
:::::: commit date: 6 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 vega12_processpptables.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- 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,12 @@ static int init_powerplay_table_informat
 	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;

      reply	other threads:[~2020-10-05 15:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 15:58 [linux-next:master 2250/13159] drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c:255:36-43: WARNING opportunity for kmemdup kernel test robot
2020-10-05 15:58 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201005155839.GA55183@076e3efa8c72 \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.