[SWDEV-387906] Fix rocm-smi initialize crash

Fix was needed due to hwmon updates.
Several voltage sensors (ex. vddgfx/vddnb)
are unsupported or not applicable
to upcoming hardware. This was not the case
for previous hardware sensors, resulting in
the rocm-smi crash observed.

Change-Id: Ib8593e10811638def26fc7a1eda29309e328db09
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
Charis Poag
2023-03-17 15:04:34 -05:00
parent 1b7eb4e1f4
commit f44d1ea8bc
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -367,15 +367,16 @@ Monitor::setVoltSensorLabelMap(void) {
}
auto add_volt_sensor_entry = [&](uint32_t file_index) {
ret = readMonitor(kMonVoltLabel, file_index, &type_str);
rsmi_voltage_type_t t_type = kVoltSensorNameMap.at(type_str);
rsmi_voltage_type_t t_type;
// If readMonitor fails, there is no label file for the file_index.
// In that case, map the type to file index 0, which is not supported
// and will fail appropriately later when we check for support.
if (ret) {
volt_type_index_map_.insert({t_type, 0});
index_volt_type_map_.insert({file_index, RSMI_VOLT_TYPE_INVALID});
} else {
volt_type_index_map_.insert({t_type, file_index});
t_type = kVoltSensorNameMap.at(type_str);
volt_type_index_map_[t_type] = file_index;
index_volt_type_map_.insert({file_index, t_type});
}
return 0;