Skip to contentSkip to conversation

drm/amdgpu: use kvcalloc for entry->entries

PATCH In review huqiqiao 2 participants 2 messages Jun 25, 2021 – Jun 28, 2021

Subsystems (2)
lore
Share & tools
lore

huqiqiao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: use kvcalloc for entry->entries

malloc_array + __GFP_ZERO is the same with kvcalloc.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index b8c31e3469c0..5cadfadc625f 100644
@@ -909,7 +909,7 @@ static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
 
 		num_entries = amdgpu_vm_num_entries(adev, cursor->level);
 		entry->entries = kvcalloc(num_entries,
-					sizeof(*entry->entries), GFP_KERNEL);
+			sizeof(*entry->entries), GFP_KERNEL);
 		if (!entry->entries)
 			return -ENOMEM;
 	}
Signature · 1 line
2.11.0
maintainer
#1 lore raw

Am 25.06.21 um 04:03 schrieb huqiqiao:

Quoted 12 lines

malloc_array + __GFP_ZERO is the same with kvcalloc.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index b8c31e3469c0..5cadfadc625f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, · line 912

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -909,7 +909,7 @@ static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
 
  		num_entries = amdgpu_vm_num_entries(adev, cursor->level);
  		entry->entries = kvcalloc(num_entries,
-					sizeof(*entry->entries), GFP_KERNEL);
+			sizeof(*entry->entries), GFP_KERNEL);

All you seem to do here is to mess up the indentation?

Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
  		if (!entry->entries)
  			return -ENOMEM;
  	}