linux/drivers/gpu/drm/amd/powerplay
Arnd Bergmann de48ebdd5b drm/amd/powerplay: vega20: fix uninitialized variable use
If smu_get_current_rpm() fails, we can't use the output,
as that may be uninitialized:

drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c:3023:8: error: variable 'current_rpm' is used uninitialized whenever '?:' condition is false [-Werror,-Wsometimes-uninitialized]
        ret = smu_get_current_rpm(smu, &current_rpm);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../powerplay/inc/amdgpu_smu.h:735:3: note: expanded from macro 'smu_get_current_rpm'
        ((smu)->funcs->get_current_rpm ? (smu)->funcs->get_current_rpm((smu), (speed)) : 0)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c:3024:12: note: uninitialized use occurs here
        percent = current_rpm * 100 / pptable->FanMaximumRpm;
                  ^~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c:3023:8: note: remove the '?:' if its condition is always true
        ret = smu_get_current_rpm(smu, &current_rpm);
              ^
drivers/gpu/drm/amd/amdgpu/../powerplay/inc/amdgpu_smu.h:735:3: note: expanded from macro 'smu_get_current_rpm'
        ((smu)->funcs->get_current_rpm ? (smu)->funcs->get_current_rpm((smu), (speed)) : 0)
         ^
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c:3020:22: note: initialize the variable 'current_rpm' to silence this warning
        uint32_t current_rpm;

Propagate the error code in that case.

Fixes: ee0db82027 ("drm/amd/powerplay: move PPTable_t uses into asic level")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-07-08 13:56:39 -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
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
Makefile drm/amd/powerplay: introduce the navi10 pptable implementation 2019-06-21 18:59:24 -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/amd/powerplay: vega20: fix uninitialized variable use 2019-07-08 13:56:39 -05:00
vega20_ppt.h drm/amd/powerplay: simplified od_settings for each asic 2019-06-21 18:59:32 -05:00