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

From: Dan Carpenter

Date: Sat Sep 12 2026 - 11:06:26 EST


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
Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
---
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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c b/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c
index 757da0a30fdc..39a748e38e9c 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c
@@ -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;
}
}

--
2.53.0