nvme_manager: fix check threshold condition

Rel: https://gerrit.openbmc.org/c/openbmc/phosphor-nvme/+/70843
After adding the NVME status flag check, the
TEMPERATURE_SENSOR_FAILURE(0x81) value will be recorded in SEL
when the NVMe status is "Drive Not Ready".

Sensor thresholds are only checked when NVMe status is available.

Tested:
Work fine when running I/O test on QBMC machine.

Change-Id: I7aa155c23d42c455a683771db5fd979ffa5f2df6
Signed-off-by: Joseph.Fu <Joseph.Fu@quantatw.com>
diff --git a/nvme_manager.cpp b/nvme_manager.cpp
index 6fa82c2..d0ef7b1 100644
--- a/nvme_manager.cpp
+++ b/nvme_manager.cpp
@@ -625,7 +625,8 @@
         nvmeSSD->setSensorThreshold(config.criticalHigh, config.criticalLow,
                                     config.warningHigh, config.warningLow);
 
-        nvmeSSD->checkSensorThreshold();
+        if (success)
+            nvmeSSD->checkSensorThreshold();
         setLEDsStatus(config, success, nvmeData);
     }
     else
@@ -641,7 +642,8 @@
                 config.criticalHigh, config.criticalLow, config.warningHigh,
                 config.warningLow);
         }
-        iter->second->checkSensorThreshold();
+        if (success)
+            iter->second->checkSensorThreshold();
         setLEDsStatus(config, success, nvmeData);
     }
 }