diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index dd7a7a18466d..309510e23315 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -3722,10 +3722,10 @@ static int kfd_mmio_mmap(struct kfd_node *dev, struct kfd_process *process, vma->vm_page_prot); } - static int kfd_mmap(struct file *filep, struct vm_area_struct *vma) { struct kfd_process *process; + struct kfd_process_device *pdd; struct kfd_node *dev = NULL; unsigned long mmap_offset; unsigned int gpu_id; @@ -3739,8 +3739,10 @@ static int kfd_mmap(struct file *filep, struct vm_area_struct *vma) mmap_offset = vma->vm_pgoff << PAGE_SHIFT; gpu_id = KFD_MMAP_GET_GPU_ID(mmap_offset); - if (gpu_id) - dev = kfd_device_by_id(gpu_id); + + pdd = kfd_process_device_data_by_id(process, gpu_id); + if (pdd) + dev = pdd->dev; switch (mmap_offset & KFD_MMAP_TYPE_MASK) { case KFD_MMAP_TYPE_DOORBELL: