linux/drivers/gpu/drm/amd/powerplay
Nathan Chancellor 68c3bd9501 drm/amd/powerplay: Zero initialize freq in smu_v11_0_get_current_clk_freq
clang warns (trimmed for brevity):

drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:1098:10: warning:
variable 'freq' is used uninitialized whenever '?:' condition is false
[-Wsometimes-uninitialized]
                ret =  smu_get_current_clk_freq_by_table(smu, clk_id, &freq);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If get_current_clk_freq_by_table is ever NULL, freq will fail to be
properly initialized. Zero initialize it to avoid using uninitialized
stack values.

smu_get_current_clk_freq_by_table expands to a ternary operator
conditional on smu->funcs->get_current_clk_freq_by_table being not NULL.
When this is false, freq will be uninitialized. Zero initialize freq to
avoid using random stack values if that ever happens.

Fixes: e36182490d ("drm/amd/powerplay: fix dpm freq unit error (10KHz -> Mhz)")
Link: https://github.com/ClangBuiltLinux/linux/issues/585
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-07-08 13:56:11 -05:00
..
hwmgr drm/amd/powerplay/smu7_hwmgr: replace blocking delay with non-blocking 2019-07-05 15:54:55 -05:00
inc drm/amd/powerplay: add baco smu reset function for smu11 2019-07-05 15:59:08 -05:00
smumgr drm/amd/powerplay: use hardware fan control if no powerplay fan table 2019-07-01 14:54:22 -05:00
Makefile drm/amd/powerplay: introduce the navi10 pptable implementation 2019-06-21 18:59:24 -05:00
amd_powerplay.c drm/amd/powerplay: fix semicolon code style issue 2019-03-19 15:04:03 -05:00
amdgpu_smu.c drm/amd/powerplay: add baco smu reset function for smu11 2019-07-05 15:59:08 -05:00
navi10_ppt.c drm/amd/powerplay: Use memset to initialize metrics structs 2019-07-08 13:56:08 -05:00
navi10_ppt.h drm/amd/powerplay: introduce the navi10 pptable implementation 2019-06-21 18:59:24 -05:00
smu_v11_0.c drm/amd/powerplay: Zero initialize freq in smu_v11_0_get_current_clk_freq 2019-07-08 13:56:11 -05:00
vega20_ppt.c drm/amdgpu/powerplay: FEATURE_MASK is 64 bit so use ULL 2019-06-25 12:08:19 -05:00
vega20_ppt.h drm/amd/powerplay: simplified od_settings for each asic 2019-06-21 18:59:32 -05:00