From 145868ad720450e36c6c2648f7596bc4aa2681a5 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_smi/src/rocm_smi_utils.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rocm_smi/src/rocm_smi_utils.cc b/rocm_smi/src/rocm_smi_utils.cc index 93ff80be74..e372209ef1 100755 --- a/rocm_smi/src/rocm_smi_utils.cc +++ b/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; }