psu-ng: Refactor temperature fault detection

Split off temperature fault checking of STATUS_WORD into its own
function.

Change-Id: Ia7dc08af12647cc7ca76356c9e9d2b75e2e95f56
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 6fd412a..b5eeb2f 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -189,6 +189,25 @@
     }
 }
 
+void PowerSupply::analyzeTemperatureFault()
+{
+    if (statusWord & phosphor::pmbus::status_word::TEMPERATURE_FAULT_WARN)
+    {
+        if (!tempFault)
+        {
+            log<level::ERR>(fmt::format("TEMPERATURE fault/warning: "
+                                        "STATUS_WORD = {:#04x}, "
+                                        "STATUS_MFR_SPECIFIC = {:#02x}, "
+                                        "STATUS_TEMPERATURE = {:#02x}",
+                                        statusWord, statusMFR,
+                                        statusTemperature)
+                                .c_str());
+        }
+
+        tempFault = true;
+    }
+}
+
 void PowerSupply::analyzePgoodFault()
 {
     if ((statusWord & phosphor::pmbus::status_word::POWER_GOOD_NEGATED) ||
@@ -372,22 +391,7 @@
                     fanFault = true;
                 }
 
-                if (statusWord & status_word::TEMPERATURE_FAULT_WARN)
-                {
-                    if (!tempFault)
-                    {
-                        log<level::ERR>(
-                            fmt::format("TEMPERATURE fault/warning: "
-                                        "STATUS_WORD = {:#04x}, "
-                                        "STATUS_MFR_SPECIFIC = {:#02x}, "
-                                        "STATUS_TEMPERATURE = {:#02x}",
-                                        statusWord, statusMFR,
-                                        statusTemperature)
-                                .c_str());
-                    }
-
-                    tempFault = true;
-                }
+                analyzeTemperatureFault();
 
                 analyzePgoodFault();