aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm
diff options
context:
space:
mode:
authorYang Wang <KevinYang.Wang@amd.com>2022-04-21 20:34:42 +0800
committerChristian König <christian.koenig@amd.com>2022-04-21 14:47:30 +0200
commit8f97344aa04b29acd69e592c3708b9045cf62794 (patch)
tree789b04551d306c9ec04f233591678e47ec97c7eb /drivers/gpu/drm/ttm
parentdrm/bridge: Fix error handling in analogix_dp_probe (diff)
downloadlinux-dev-8f97344aa04b29acd69e592c3708b9045cf62794.tar.xz
linux-dev-8f97344aa04b29acd69e592c3708b9045cf62794.zip
drm/ttm: use kvcalloc() instead of kvmalloc_array() in ttm_tt v2
simplify programming with existing functions. v2 (chk): minimal coding style cleanup Signed-off-by: Yang Wang <KevinYang.Wang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220421123442.1834102-1-KevinYang.Wang@amd.com Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 1a66d9fc589a..d505603930a7 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -96,19 +96,17 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
*/
static int ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
{
- ttm->pages = kvmalloc_array(ttm->num_pages, sizeof(void*),
- GFP_KERNEL | __GFP_ZERO);
+ ttm->pages = kvcalloc(ttm->num_pages, sizeof(void*), GFP_KERNEL);
if (!ttm->pages)
return -ENOMEM;
+
return 0;
}
static int ttm_dma_tt_alloc_page_directory(struct ttm_tt *ttm)
{
- ttm->pages = kvmalloc_array(ttm->num_pages,
- sizeof(*ttm->pages) +
- sizeof(*ttm->dma_address),
- GFP_KERNEL | __GFP_ZERO);
+ ttm->pages = kvcalloc(ttm->num_pages, sizeof(*ttm->pages) +
+ sizeof(*ttm->dma_address), GFP_KERNEL);
if (!ttm->pages)
return -ENOMEM;
@@ -118,11 +116,11 @@ static int ttm_dma_tt_alloc_page_directory(struct ttm_tt *ttm)
static int ttm_sg_tt_alloc_page_directory(struct ttm_tt *ttm)
{
- ttm->dma_address = kvmalloc_array(ttm->num_pages,
- sizeof(*ttm->dma_address),
- GFP_KERNEL | __GFP_ZERO);
+ ttm->dma_address = kvcalloc(ttm->num_pages, sizeof(*ttm->dma_address),
+ GFP_KERNEL);
if (!ttm->dma_address)
return -ENOMEM;
+
return 0;
}