From 72009f1812cb23c72c87a40c82682576d9d727d8 Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Wed, 28 Jun 2023 09:03:28 -0500 Subject: [PATCH] Return NOT_SUPPORTED if fail to write to sysfs Check the error and return NOT_SUPPORTED when write to sysfs. Change-Id: Idaa91816197413643552e230a483b79500d44e08 [ROCm/amdsmi commit: 145868ad720450e36c6c2648f7596bc4aa2681a5] --- projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc index 93ff80be74..e372209ef1 100755 --- a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc +++ b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc @@ -120,6 +120,9 @@ int WriteSysfsStr(std::string path, std::string val) { fs << val; fs.close(); + if (!fs) { + return ENOENT; // Map to NOT_SUPPORT if errors + } return ret; }