drm/amdgpu: initialize ret before UMC error record loop
Subsystems (2)
PATCH v3 1/1 drm/amdgpu: initialize ret before UMC error record loop
umc_v12_0_fill_error_record() returns ret after walking the pages reported by amdgpu_umc_lookup_bad_pages_in_a_row(). That helper can return zero entries, leaving the loop skipped and ret uninitialized.
Initialize ret to -EINVAL immediately before the loop so the zero-entry path returns a deterministic error status while preserving the existing loop behavior when at least one page is processed.
---
v3:
- Initialize ret to -EINVAL instead of 0 to match the original error semantics preferred by Tao Zhou.
v2:
- Set ret immediately before the loop instead of initializing it in the declaration, as suggested by Christian.
- Avoid describing the zero-entry case as an allocation-failure fix.
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c +1 -0
@@ -689,6 +689,7 @@ static int umc_v12_0_fill_error_record(struct amdgpu_device *adev, count =amdgpu_umc_lookup_bad_pages_in_a_row (adev, ecc_err->pa_pfn <<AMDGPU_GPU_PAGE_SHIFT , page_pfn,ARRAY_SIZE (page_pfn)); + ret = -EINVAL ;for (i =0 ; i < count; i++) { ret = amdgpu_umc_fill_error_record(err_data,
Signature · 1 line
2.51.0
AMD General
Quoted 54 lines
-----Original Message-----
From: Ruoyu Wang <[email protected]>
Sent: Saturday, June 20, 2026 2:12 PM
To: Deucher, Alexander <[email protected]>
Cc: Koenig, Christian <[email protected]>; Zhou1, Tao <[email protected]>; Lazar, Lijo <[email protected]>; Zhang, Hawking <[email protected]>; [email protected]; [email protected]; amd- [email protected]; [email protected]; linux- [email protected]; Ruoyu Wang <[email protected]>
Subject: [PATCH v3] drm/amdgpu: initialize ret before UMC error record loop[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
umc_v12_0_fill_error_record()returns ret after walking the pages reported byamdgpu_umc_lookup_bad_pages_in_a_row(). That helper can return zero entries, leaving the loop skipped and ret uninitialized.Initialize ret to
-EINVALimmediately before the loop so the zero-entry path returns a deterministic error status while preserving the existing loop behavior when at least one page is processed.Suggested-by Christian König <[email protected]>Suggested-by Tao Zhou <[email protected]>Signed-off-by Ruoyu Wang <[email protected]>---
v3:
- Initialize ret to-EINVALinstead of 0 to match the original error semantics preferred by Tao Zhou.v2:
- Set ret immediately before the loop instead of initializing it in the declaration, as suggested by Christian.
- Avoid describing the zero-entry case as an allocation-failure fix.drivers/gpu/drm/amd/amdgpu/umc_v12_0.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/umc_v12_0.c +1
-0@@ -689,6 +689,7 @@ static int umc_v12_0_fill_error_record(structamdgpu_device *adev, count =amdgpu_umc_lookup_bad_pages_in_a_row (adev, ecc_err->pa_pfn <<AMDGPU_GPU_PAGE_SHIFT , page_pfn,ARRAY_SIZE (page_pfn)); + ret = -EINVAL ;for (i =0 ; i < count; i++) {ret = amdgpu_umc_fill_error_record(err_data,
--
2.51.0