diff options
author | Tian Tao <tiantao6@hisilicon.com> | 2020-12-23 04:26:33 +0300 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2020-12-28 12:41:53 +0300 |
commit | 82096ecf589d8224447213c4592e54598fea0b9d (patch) | |
tree | 07df064cb39745eb318483175dc2d7cf0e39d5c0 /drivers/thunderbolt | |
parent | 5c8fe583cce542aa0b84adc939ce85293de36e5e (diff) | |
download | linux-82096ecf589d8224447213c4592e54598fea0b9d.tar.xz |
thunderbolt: Use kmemdup instead of kzalloc and memcpy
Fixes coccicheck warning:
drivers/thunderbolt/dma_test.c:302:13-20: WARNING opportunity for kmemdup.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r-- | drivers/thunderbolt/dma_test.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/thunderbolt/dma_test.c b/drivers/thunderbolt/dma_test.c index f924423fa180..955f980986ca 100644 --- a/drivers/thunderbolt/dma_test.c +++ b/drivers/thunderbolt/dma_test.c @@ -299,14 +299,12 @@ static int dma_test_submit_tx(struct dma_test *dt, size_t npackets) tf->frame.size = 0; /* means 4096 */ tf->dma_test = dt; - tf->data = kzalloc(DMA_TEST_FRAME_SIZE, GFP_KERNEL); + tf->data = 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 = dma_map_single(dma_dev, tf->data, DMA_TEST_FRAME_SIZE, DMA_TO_DEVICE); if (dma_mapping_error(dma_dev, dma_addr)) { |