Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/powerplay: don't succeed in getters if fan is missing

Otherwise callers end up using uninitialized data.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Grazvydas Ignotas and committed by
Alex Deucher
91efdb27 eef2b411

+3 -3
+3 -3
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
··· 30 30 struct phm_fan_speed_info *fan_speed_info) 31 31 { 32 32 if (hwmgr->thermal_controller.fanInfo.bNoFan) 33 - return 0; 33 + return -ENODEV; 34 34 35 35 fan_speed_info->supports_percent_read = true; 36 36 fan_speed_info->supports_percent_write = true; ··· 60 60 uint64_t tmp64; 61 61 62 62 if (hwmgr->thermal_controller.fanInfo.bNoFan) 63 - return 0; 63 + return -ENODEV; 64 64 65 65 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 66 66 CG_FDO_CTRL1, FMAX_DUTY100); ··· 89 89 if (hwmgr->thermal_controller.fanInfo.bNoFan || 90 90 (hwmgr->thermal_controller.fanInfo. 91 91 ucTachometerPulsesPerRevolution == 0)) 92 - return 0; 92 + return -ENODEV; 93 93 94 94 tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 95 95 CG_TACH_STATUS, TACH_PERIOD);