Content-Type: multipart/mixed; boundary="===============1541996865278811399==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] FROMGIT: thunderbolt: fix memdup.cocci warnings Date: Wed, 18 Nov 2020 14:19:26 +0800 Message-ID: <20201118061926.GA9175@6f3a377fa644> In-Reply-To: <202011181410.4dO9yl7x-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============1541996865278811399== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org TO: cros-kernel-buildreports(a)googlegroups.com TO: Guenter Roeck From: kernel test robot drivers/thunderbolt/dma_test.c:302:13-20: WARNING opportunity for kmemdup Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci Fixes: e56d76e37b90 ("FROMGIT: thunderbolt: Add DMA traffic test driver") CC: Isaac Hazan Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chr= omeos-5.4 head: 694851c854b7836ffd9c561ae548fe4dc33d1218 commit: e56d76e37b90ac29385f47c0f102d79be1dacad4 [25/35] FROMGIT: thunderbo= lt: Add DMA traffic test driver :::::: branch date: 2 hours ago :::::: commit date: 20 hours ago Please take the patch only if it's a positive warning. Thanks! dma_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/thunderbolt/dma_test.c +++ b/drivers/thunderbolt/dma_test.c @@ -299,14 +299,13 @@ static int dma_test_submit_tx(struct dma tf->frame.size =3D 0; /* means 4096 */ tf->dma_test =3D dt; = - tf->data =3D kzalloc(DMA_TEST_FRAME_SIZE, GFP_KERNEL); + tf->data =3D kmemdup(dma_test_pattern, DMA_TEST_FRAME_SIZE, + GFP_KERNEL); if (!tf->data) { kfree(tf); return -ENOMEM; } = - memcpy(tf->data, dma_test_pattern, DMA_TEST_FRAME_SIZE); - dma_addr =3D dma_map_single(dma_dev, tf->data, DMA_TEST_FRAME_SIZE, DMA_TO_DEVICE); if (dma_mapping_error(dma_dev, dma_addr)) { --===============1541996865278811399==--