drm/amd/powerplay: don't succeed in getters if fan is missing
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: don't succeed in getters if fan is missing
Otherwise callers end up using uninitialized data.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +3 -3
@@ -30,7 +30,7 @@ int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info) {if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +return -ENODEV ; fan_speed_info->supports_percent_read = true; fan_speed_info->supports_percent_write = true;
@@ -60,7 +60,7 @@ int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr,uint64_t tmp64;if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +return -ENODEV ; duty100 =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_FDO_CTRL1 ,FMAX_DUTY100 );
@@ -89,7 +89,7 @@ int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed)if (hwmgr->thermal_controller.fanInfo.bNoFan || (hwmgr->thermal_controller.fanInfo. ucTachometerPulsesPerRevolution ==0 )) -return 0 ; +return -ENODEV ; tach_period =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_TACH_STATUS ,TACH_PERIOD );
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1477773164-23837-1-git-send-email-notasas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Edward O'Callaghan
Reviewed-byQuoted 31 lines · Grazvydas Ignotas
Otherwise callers end up using uninitialized data.
Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +2
-2@@ -30,7 +30,7 @@ int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info) {if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +return -ENODEV ; fan_speed_info->supports_percent_read = true; fan_speed_info->supports_percent_write = true;@@ -60,7 +60,7 @@ int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr,uint64_t tmp64;if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +return -ENODEV ; duty100 =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_FDO_CTRL1 ,FMAX_DUTY100 );
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) · line 95
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +1
-1@@ -89,7 +89,7 @@ int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed)if (hwmgr->thermal_controller.fanInfo.bNoFan || (hwmgr->thermal_controller.fanInfo. ucTachometerPulsesPerRevolution ==0 )) -return 0 ; +return -ENODEV ; tach_period =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_TACH_STATUS ,TACH_PERIOD );
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 9903cfe8-3f4b-8ced-d87f-51afca5e4589-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org
Alex Deucher
AppliedQuoted 6 lines · Edward O'Callaghan
Reviewed-by Edward O'Callaghan <[email protected]>Quoted 3 lines · Grazvydas Ignotas
Otherwise callers end up using uninitialized data.
Signed-off-by Grazvydas Ignotas <[email protected]>
Applied. thanks!
Alex
Quoted 33 lines
Quoted 33 lines
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +3
-3@@ -30,7 +30,7 @@ int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info) {if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +return -ENODEV ; fan_speed_info->supports_percent_read = true; fan_speed_info->supports_percent_write = true;@@ -60,7 +60,7 @@ int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr,uint64_t tmp64;if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +return -ENODEV ; duty100 =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_FDO_CTRL1 ,FMAX_DUTY100 );@@ -89,7 +89,7 @@ int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed)if (hwmgr->thermal_controller.fanInfo.bNoFan || (hwmgr->thermal_controller.fanInfo. ucTachometerPulsesPerRevolution ==0 )) -return 0 ; +return -ENODEV ;
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) · line 95
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +0
-0tach_period =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_TACH_STATUS ,TACH_PERIOD );_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx