Skip to contentSkip to conversation

drm/amdgpu: Remove redundant mode2 restore check

PATCH New Dan Carpenter 1 participant 1 message Sep 12 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: Remove redundant mode2 restore check

In reply to a message not in the archive

The "r" variable is checked twice. We already know it is zero/success at this point so there is no need to check again. Delete the redundant check and pull the code in a tab.

Fixes 208e5d4b3f1e2 ("drm/amd/amdgpu: Add soc_v1_0 reset handler")
Assisted-by Codex:GPT-5

---
In retrospect, I probably could have deleted these tabs without AI help.

 drivers/gpu/drm/amd/amdgpu/soc_v1_0.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc_v1_0.c +9 -12
index 757da0a30fdc..39a748e38e9c 100644
@@ -729,19 +729,16 @@ soc_v1_0_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl,
 
 		amdgpu_ras_resume(tmp_adev);
 
-		if (!r) {
-			amdgpu_set_init_level(tmp_adev,
-					      AMDGPU_INIT_LEVEL_DEFAULT);
-			amdgpu_irq_gpu_reset_resume_helper(tmp_adev);
+		amdgpu_set_init_level(tmp_adev, AMDGPU_INIT_LEVEL_DEFAULT);
+		amdgpu_irq_gpu_reset_resume_helper(tmp_adev);
 
-			r = amdgpu_ib_ring_tests(tmp_adev);
-			if (r) {
-				dev_err(tmp_adev->dev,
-					"ib ring test failed (%d).\n", r);
-				r = -EAGAIN;
-				tmp_adev->asic_reset_res = r;
-				goto end;
-			}
+		r = amdgpu_ib_ring_tests(tmp_adev);
+		if (r) {
+			dev_err(tmp_adev->dev,
+				"ib ring test failed (%d).\n", r);
+			r = -EAGAIN;
+			tmp_adev->asic_reset_res = r;
+			goto end;
 		}
 	}
 
Signature · 1 line
2.53.0