Add null ptr check for temperature read from all sensors.

The (temperature == nullptr) check happens only when HBM temperature is retrieved.
This check needs to apply in other cases as well, hence moving this outside the HBM condition.
This should return RSMI_STATUS_INVALID_ARGS consistently in all cases when nullptr is passed through rsmitst.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Iea3cec75312a0a669c7da27e15e9782e6a885c5f


[ROCm/rocm_smi_lib commit: 432df20321]
This commit is contained in:
Divya Shikre
2021-12-01 11:43:50 -05:00
committed by Divya Uday Shikre
parent 92fe455a8e
commit a83ee69dd3
+4 -4
View File
@@ -2130,6 +2130,10 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
mon_type = amd::smi::kMonInvalid;
}
if (temperature == nullptr) {
return RSMI_STATUS_INVALID_ARGS;
}
// The HBM temperature is retreived from the gpu_metrics
if (sensor_type == RSMI_TEMP_TYPE_HBM_0
|| sensor_type == RSMI_TEMP_TYPE_HBM_1
@@ -2145,10 +2149,6 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
return ret;
}
if (temperature == nullptr) {
return RSMI_STATUS_INVALID_ARGS;
}
switch (sensor_type) {
case RSMI_TEMP_TYPE_HBM_0:
val_ui16 = gpu_metrics.temperature_hbm[0];