[SWDEV-556005 & SWDEV-556853] Initialize temp-type map
Added back the temp-type map initialization to RSMI_TEMP_TYPE_INVALID before probing hwmon files. This prevents std::out_of_range for unsupported or absent temperature sensor types. Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>
This commit is contained in:
committed by
Arif, Maisam
parent
6550c51b35
commit
3e7e4ab1ac
@@ -336,7 +336,11 @@ Monitor::setTempSensorLabelMap(void) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
for (uint32_t i = RSMI_TEMP_TYPE_FIRST; i <= RSMI_TEMP_TYPE_LAST; ++i) {
|
||||
for (uint32_t t = RSMI_TEMP_TYPE_FIRST; t <= RSMI_TEMP_TYPE_LAST; ++t) {
|
||||
temp_type_index_map_.insert(
|
||||
{static_cast<rsmi_temperature_type_t>(t), RSMI_TEMP_TYPE_INVALID});
|
||||
}
|
||||
for (uint32_t i = 1; i <= RSMI_TEMP_TYPE_LAST + 1; ++i) {
|
||||
if ((i <= RSMI_TEMP_TYPE_GENERAL_LAST) ||
|
||||
(i >= RSMI_TEMP_TYPE_GPUBOARD_NODE_FIRST && i <= RSMI_TEMP_TYPE_GPUBOARD_NODE_LAST) ||
|
||||
(i >= RSMI_TEMP_TYPE_GPUBOARD_VR_FIRST && i <= RSMI_TEMP_TYPE_GPUBOARD_LAST) ||
|
||||
@@ -345,9 +349,6 @@ Monitor::setTempSensorLabelMap(void) {
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
temp_type_index_map_.insert(
|
||||
{static_cast<rsmi_temperature_type_t>(i), RSMI_TEMP_TYPE_INVALID});
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user