amdgpu_vmid_alloc_reserved() returns success when the VM already has a
reserved VMID, but returns -ENOENT when the manager already has one
reserved.
Both cases indicate that a reserved VMID already exists and the
reservation cannot proceed.
Return -ENOENT in both cases for consistent behavior and to fix the
Smatch about a missing error code.
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c:471 amdgpu_vmid_alloc_reserved() warn:
missing error code 'r'
Fixes: 90e09ea4cfd4 ("drm/amdgpu: revert "rework reserved VMID handling" v2")
Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
index 9cab36322c16..d0dedac630b2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
@@ -467,8 +467,10 @@ int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev,
struct amdgpu_vm *vm,
int r = 0;
mutex_lock(&id_mgr->lock);
- if (vm->reserved_vmid[vmhub])
+ if (vm->reserved_vmid[vmhub]) {
+ r = -ENOENT;
goto unlock;
+ }
if (id_mgr->reserved_vmid) {
r = -ENOENT;
goto unlock;
--
2.34.1