From ebec7991cb03fe0bbb9bbcd6bb2b77ce5f0e7c49 Mon Sep 17 00:00:00 2001 From: Divya Shikre Date: Tue, 11 May 2021 11:21:55 -0400 Subject: [PATCH] Return an error when user tries to set out of range clock values for setsrange functionality Signed-off-by: Divya Shikre Change-Id: Ibe1075c1d2b6c009332a52b81f4b41f7e93d0756 [ROCm/amdsmi commit: 462d4adc24de43a9affc4766346b24a93a69adb2] --- projects/amdsmi/src/rocm_smi_device.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/amdsmi/src/rocm_smi_device.cc b/projects/amdsmi/src/rocm_smi_device.cc index 5377964c02..51e6782263 100755 --- a/projects/amdsmi/src/rocm_smi_device.cc +++ b/projects/amdsmi/src/rocm_smi_device.cc @@ -617,16 +617,21 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) { std::ofstream fs; int ret; + fs.rdbuf()->pubsetbuf(0,0); ret = openSysfsFileStream(type, &fs, valStr.c_str()); if (ret != 0) { return ret; } // We'll catch any exceptions in rocm_smi.cc code. - fs << valStr; + if (fs << valStr) { + ret = RSMI_STATUS_SUCCESS; + } else { + ret = RSMI_STATUS_NOT_SUPPORTED; + } fs.close(); - - return 0; + + return ret; } rsmi_dev_perf_level Device::perfLvlStrToEnum(std::string s) {