The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return a negative error code to the user.
Fixes: 030d5b97a54b ("drm/amdgpu: use amdgpu_device_vram_access in amdgpu_ttm_vram_read")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
 {
        struct amdgpu_device *adev = file_inode(f)->i_private;
        ssize_t result = 0;
-       int r;
 
        if (size & 0x3 || *pos & 0x3)
                return -EINVAL;
                uint32_t value[AMDGPU_TTM_VRAM_MAX_DW_READ];
 
                amdgpu_device_vram_access(adev, *pos, value, bytes, false);
-               r = copy_to_user(buf, value, bytes);
-               if (r)
-                       return r;
+               if (copy_to_user(buf, value, bytes))
+                       return -EFAULT;
 
                result += bytes;
                buf += bytes;