aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorzhong jiang <zhongjiang@huawei.com>2018-09-18 11:35:32 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-11-05 14:20:36 -0500
commit6dfeb11a4b48e4994ac9e22eef5720f17d1f3502 (patch)
tree7e10e783984f63754a4272b8cc55d71f6306fcc1 /drivers/gpu/drm/amd
parent651022382c7f8da46cb4872a545ee1da6d097d2a (diff)
drm/amdkfd: Use kmemdup instead of duplicating its function
kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation. Signed-off-by: zhong jiang <zhongjiang@huawei.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_crat.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 56412b0e7e1c..dd4f3bdbf08c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -753,12 +753,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
753 return -ENODATA; 753 return -ENODATA;
754 } 754 }
755 755
756 pcrat_image = kmalloc(crat_table->length, GFP_KERNEL); 756 pcrat_image = kmemdup(crat_table, crat_table->length, GFP_KERNEL);
757 if (!pcrat_image) 757 if (!pcrat_image)
758 return -ENOMEM; 758 return -ENOMEM;
759 759
760 memcpy(pcrat_image, crat_table, crat_table->length);
761
762 *crat_image = pcrat_image; 760 *crat_image = pcrat_image;
763 *size = crat_table->length; 761 *size = crat_table->length;
764 762