drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 30 Mar 2018 02:25:17 +0000 (02:25 +0000)
committerOded Gabbay <oded.gabbay@gmail.com>
Tue, 24 Apr 2018 09:14:55 +0000 (12:14 +0300)
Passing NULL pointer to PTR_ERR will result in return value of 0
indicating success which is clearly not what it is intended here.
This patch returns -EINVAL instead.

v2: change ret code to -ENODEV

Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

index fb5d997e41483926da3f23547acda1f4b5ef92c3..f65e0142d42e98126433b92707a2a41e42b851aa 100644 (file)
@@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
 
        pdd = kfd_get_process_device_data(dev, p);
        if (!pdd) {
-               err = PTR_ERR(pdd);
+               err = -EINVAL;
                goto bind_process_to_device_failed;
        }