diff mbox series

drm/amdgpu:use kvcalloc instead of kvmalloc_array

Message ID 20210623091242.12861-1-huqiqiao@uniontech.com (mailing list archive)
State New, archived
Headers show
Series drm/amdgpu:use kvcalloc instead of kvmalloc_array | expand

Commit Message

huqiqiao June 23, 2021, 9:12 a.m. UTC
kvmalloc_array + __GFP_ZERO is the same with kvcalloc.

Signed-off-by: huqiqiao <huqiqiao@uniontech.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Christian König June 24, 2021, 1:14 p.m. UTC | #1
Am 23.06.21 um 11:12 schrieb huqiqiao:
> kvmalloc_array + __GFP_ZERO is the same with kvcalloc.
>
> Signed-off-by: huqiqiao <huqiqiao@uniontech.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 9acee4a5b2ba..50edc73525b0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -908,9 +908,8 @@ static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
>   		unsigned num_entries;
>   
>   		num_entries = amdgpu_vm_num_entries(adev, cursor->level);
> -		entry->entries = kvmalloc_array(num_entries,
> -						sizeof(*entry->entries),
> -						GFP_KERNEL | __GFP_ZERO);
> +		entry->entries = kvcalloc(num_entries,
> +						sizeof(*entry->entries), GFP_KERNEL);

Sounds like a good idea in general, but the indentation on the second 
line seems to be of.

Christian.

>   		if (!entry->entries)
>   			return -ENOMEM;
>   	}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 9acee4a5b2ba..50edc73525b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -908,9 +908,8 @@  static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
 		unsigned num_entries;
 
 		num_entries = amdgpu_vm_num_entries(adev, cursor->level);
-		entry->entries = kvmalloc_array(num_entries,
-						sizeof(*entry->entries),
-						GFP_KERNEL | __GFP_ZERO);
+		entry->entries = kvcalloc(num_entries,
+						sizeof(*entry->entries), GFP_KERNEL);
 		if (!entry->entries)
 			return -ENOMEM;
 	}