AMD General

Reviewed-by: Tao Zhou <[email protected]>

> -----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 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.
>
> Suggested-by: Christian König <[email protected]>
> Suggested-by: Tao Zhou <[email protected]>
> Signed-off-by: Ruoyu Wang <[email protected]>
> ---
> 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(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> b/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> index db505ab32fa0f..382e6d2dda9c1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> @@ -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,
> --
> 2.51.0

Reply via email to