* [PATCH] drm/amdgpu: initialize ret in UMC error record fill
@ 2026-06-17 18:37 Ruoyu Wang
2026-06-17 18:40 ` Christian König
0 siblings, 1 reply; 2+ messages in thread
From: Ruoyu Wang @ 2026-06-17 18:37 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
amd-gfx, dri-devel, linux-kernel
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, including when its temporary allocation fails, leaving the
loop skipped and ret uninitialized.
Initialize ret to 0 so the zero-page path reports a deterministic status
instead of returning stack data.
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
index 14092150336a5..77a9f6a47d428 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
@@ -681,7 +681,7 @@ static int umc_v12_0_fill_error_record(struct amdgpu_device *adev,
{
struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
uint64_t page_pfn[UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL];
- int ret, i, count;
+ int ret = 0, i, count;
if (!err_data || !ecc_err)
return -EINVAL;
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu: initialize ret in UMC error record fill
2026-06-17 18:37 [PATCH] drm/amdgpu: initialize ret in UMC error record fill Ruoyu Wang
@ 2026-06-17 18:40 ` Christian König
0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2026-06-17 18:40 UTC (permalink / raw)
To: Ruoyu Wang, Alex Deucher, David Airlie, Simona Vetter, amd-gfx,
dri-devel, linux-kernel
On 6/17/26 20:37, Ruoyu Wang wrote:
> 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, including when its temporary allocation fails, leaving the
> loop skipped and ret uninitialized.
>
> Initialize ret to 0 so the zero-page path reports a deterministic status
> instead of returning stack data.
>
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
> drivers/gpu/drm/amd/amdgpu/umc_v12_0.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> index 14092150336a5..77a9f6a47d428 100644
> --- a/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
> @@ -681,7 +681,7 @@ static int umc_v12_0_fill_error_record(struct amdgpu_device *adev,
> {
> struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
> uint64_t page_pfn[UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL];
> - int ret, i, count;
> + int ret = 0, i, count;
That is usually considered bad coding style. Better initialize the variable directly before the loop.
Regards,
Christian.
>
> if (!err_data || !ecc_err)
> return -EINVAL;
> --
> 2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-17 18:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17 18:37 [PATCH] drm/amdgpu: initialize ret in UMC error record fill Ruoyu Wang
2026-06-17 18:40 ` Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®