aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrazvydas Ignotas <notasas@gmail.com>2016-10-29 16:32:44 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-10-31 12:33:31 -0400
commit91efdb2718e0c5ff014f0cf98cac99f088a9a4d2 (patch)
tree86a483405d1d3c14c064a6f5d55fb696f9183371
parenteef2b41122425dbddd16d70371bd000f601161d6 (diff)
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>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
index fb6c6f6106d5..29d0319b22e6 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
@@ -30,7 +30,7 @@ int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr,
30 struct phm_fan_speed_info *fan_speed_info) 30 struct phm_fan_speed_info *fan_speed_info)
31{ 31{
32 if (hwmgr->thermal_controller.fanInfo.bNoFan) 32 if (hwmgr->thermal_controller.fanInfo.bNoFan)
33 return 0; 33 return -ENODEV;
34 34
35 fan_speed_info->supports_percent_read = true; 35 fan_speed_info->supports_percent_read = true;
36 fan_speed_info->supports_percent_write = true; 36 fan_speed_info->supports_percent_write = true;
@@ -60,7 +60,7 @@ int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr,
60 uint64_t tmp64; 60 uint64_t tmp64;
61 61
62 if (hwmgr->thermal_controller.fanInfo.bNoFan) 62 if (hwmgr->thermal_controller.fanInfo.bNoFan)
63 return 0; 63 return -ENODEV;
64 64
65 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 65 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
66 CG_FDO_CTRL1, FMAX_DUTY100); 66 CG_FDO_CTRL1, FMAX_DUTY100);
@@ -89,7 +89,7 @@ int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed)
89 if (hwmgr->thermal_controller.fanInfo.bNoFan || 89 if (hwmgr->thermal_controller.fanInfo.bNoFan ||
90 (hwmgr->thermal_controller.fanInfo. 90 (hwmgr->thermal_controller.fanInfo.
91 ucTachometerPulsesPerRevolution == 0)) 91 ucTachometerPulsesPerRevolution == 0))
92 return 0; 92 return -ENODEV;
93 93
94 tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 94 tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
95 CG_TACH_STATUS, TACH_PERIOD); 95 CG_TACH_STATUS, TACH_PERIOD);