Skip to contentSkip to conversation

drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Feb 15, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

Currently, if amdgpu_vm_bo_update() fails, the returned error is being ignored.

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update. Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")

Fixes 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -3
index e48b4ec..db85fc0 100644
@@ -523,12 +523,13 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
 		goto error;
 
 	if (operation == AMDGPU_VA_OP_MAP ||
-	    operation == AMDGPU_VA_OP_REPLACE)
+	    operation == AMDGPU_VA_OP_REPLACE) {
 		r = amdgpu_vm_bo_update(adev, bo_va, false);
+		if (r)
+			goto error;
+	}
 
 	r = amdgpu_vm_update_directories(adev, vm);
-	if (r)
-		goto error;
 
 error:
 	if (r && r != -ERESTARTSYS)
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw

Am 15.02.2018 um 06:20 schrieb Gustavo A. R. Silva:

Quoted 9 lines

Currently, if amdgpu_vm_bo_update() fails, the returned error is being ignored.

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update. Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")

Fixes 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
Quoted 15 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
index e48b4ec..db85fc0 100644
@@ -523,12 +523,13 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
  		goto error;
 
  	if (operation == AMDGPU_VA_OP_MAP ||
-	    operation == AMDGPU_VA_OP_REPLACE)
+	    operation == AMDGPU_VA_OP_REPLACE) {
  		r = amdgpu_vm_bo_update(adev, bo_va, false);

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · line 535

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -2
+		if (r)
+			goto error;
+	}
 
  	r = amdgpu_vm_update_directories(adev, vm);
-	if (r)
-		goto error;
 
  error:
  	if (r && r != -ERESTARTSYS)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 4 lines · Christian König

Am 15.02.2018 um 06:20 schrieb Gustavo A. R. Silva:

Quoted 3 lines

Currently, if amdgpu_vm_bo_update() fails, the returned error is being ignored.

Quoted 9 lines
Quoted 6 lines

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update. Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")

Fixes 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")

Thanks, Christian
--
Gustavo

Quoted 24 lines
Quoted 23 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---

  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index e48b4ec..db85fc0 100644
@@ -523,12 +523,13 @@ static void amdgpu_gem_va_update_vm(struct 
 amdgpu_device *adev,
           goto error;

      if (operation == AMDGPU_VA_OP_MAP ||
-        operation == AMDGPU_VA_OP_REPLACE)
+        operation == AMDGPU_VA_OP_REPLACE) { r = amdgpu_vm_bo_update(adev, bo_va, false); +        if (r)
+            goto error;
+    }
      r = amdgpu_vm_update_directories(adev, vm); -    if (r)
-        goto error;
  error:
      if (r && r != -ERESTARTSYS)