[PATCH 1/3] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr
Deucher, Alexander
Alexander.Deucher at amd.com
Wed Apr 24 18:17:33 UTC 2024
[AMD Official Use Only - General]
> -----Original Message-----
> From: Ma, Jun <Jun.Ma2 at amd.com>
> Sent: Wednesday, April 24, 2024 6:04 AM
> To: amd-gfx at lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: Ma, Jun <Jun.Ma2 at amd.com>
> 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 at amd.com>
> ---
> 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
More information about the amd-gfx
mailing list