drm/amdgpu: debugfs: fix error codes in write functions
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 26 Apr 2022 08:48:03 +0000 (11:48 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Apr 2022 15:52:20 +0000 (11:52 -0400)
commita52ad5b6ce0df125d0d9ea169b61ae6cc098f047
tree20b3218dfc5a938d1515dc457833eb89ce31080c
parenta6f2e0d9fe6399ff060ae3de28089a4e0462b6cf
drm/amdgpu: debugfs: fix error codes in write functions

There are two error code bugs here.  The copy_to/from_user() functions
return the number of bytes remaining (a positive number).  We should
return -EFAULT if the copy fails.

Second if we fail because "context.resp_status" is non-zero then return
-EINVAL instead of zero.

Fixes: e50d9ba0d2cd ("drm/amdgpu: Add debugfs TA load/unload/invoke support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c