Commit 8c45a834 authored by Philip Yang's avatar Philip Yang Committed by Alex Deucher

drm/amdkfd: Cleanup KFD nodes creation

kfd node allocation outside kfd->num_nodes loop is not needed and causes
memory leak because kfd->num_nodes is at least equal to 1.
Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4482d3c9
...@@ -729,26 +729,12 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, ...@@ -729,26 +729,12 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
/* TODO: Needs to be updated for memory partitioning */ /* TODO: Needs to be updated for memory partitioning */
svm_migrate_init(kfd->adev); svm_migrate_init(kfd->adev);
/* Allocate the KFD node */
node = kzalloc(sizeof(struct kfd_node), GFP_KERNEL);
if (!node) {
dev_err(kfd_device, "Error allocating KFD node\n");
goto node_alloc_error;
}
node->adev = kfd->adev;
node->kfd = kfd;
node->kfd2kgd = kfd->kfd2kgd;
node->vm_info.vmid_num_kfd = vmid_num_kfd;
node->vm_info.first_vmid_kfd = first_vmid_kfd;
node->vm_info.last_vmid_kfd = last_vmid_kfd;
node->max_proc_per_quantum = max_proc_per_quantum;
atomic_set(&node->sram_ecc_flag, 0);
amdgpu_amdkfd_get_local_mem_info(kfd->adev, &kfd->local_mem_info); amdgpu_amdkfd_get_local_mem_info(kfd->adev, &kfd->local_mem_info);
dev_info(kfd_device, "Total number of KFD nodes to be created: %d\n", dev_info(kfd_device, "Total number of KFD nodes to be created: %d\n",
kfd->num_nodes); kfd->num_nodes);
/* Allocate the KFD nodes */
for (i = 0; i < kfd->num_nodes; i++) { for (i = 0; i < kfd->num_nodes; i++) {
node = kzalloc(sizeof(struct kfd_node), GFP_KERNEL); node = kzalloc(sizeof(struct kfd_node), GFP_KERNEL);
if (!node) if (!node)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment