[AMD Official Use Only - General] > -----Original Message----- > From: Ma, Jun <Jun.Ma2@xxxxxxx> > Sent: Wednesday, April 24, 2024 6:04 AM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; Koenig, Christian > <Christian.Koenig@xxxxxxx>; Deucher, Alexander > <Alexander.Deucher@xxxxxxx> > Cc: Ma, Jun <Jun.Ma2@xxxxxxx> > Subject: [PATCH 1/3] drm/amdgpu: Fix uninitialized variable warning in > amdgpu_afmt_acr > > Assign value to clock to fix the warning below: > "Using uninitialized value res. Field res.clock is uninitialized" > > Signed-off-by: Ma Jun <Jun.Ma2@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c > index a4d65973bf7c..9e3442b2d2ec 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c > @@ -87,7 +87,7 @@ static void amdgpu_afmt_calc_cts(uint32_t clock, int > *CTS, int *N, int freq) > > struct amdgpu_afmt_acr amdgpu_afmt_acr(uint32_t clock) { > - struct amdgpu_afmt_acr res; > + struct amdgpu_afmt_acr res = {0}; I think you can drop this hunk since all of the fields are initialized below. Alex > u8 i; > > /* Precalculated values for common clocks */ @@ -100,6 +100,7 @@ > struct amdgpu_afmt_acr amdgpu_afmt_acr(uint32_t clock) > amdgpu_afmt_calc_cts(clock, &res.cts_32khz, &res.n_32khz, 32000); > amdgpu_afmt_calc_cts(clock, &res.cts_44_1khz, &res.n_44_1khz, > 44100); > amdgpu_afmt_calc_cts(clock, &res.cts_48khz, &res.n_48khz, 48000); > + res.clock = clock; > > return res; > } > -- > 2.34.1