psu-ng: Refactor VOUT_OV_FAULT detection

Split off code checking for VOUT_OV fault in STATUS_WORD to its own
function.

Change-Id: Id5fef1a3830ff4a60ca235bbf83b3f99caea5986
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 1726c4b..e31734b 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -222,6 +222,24 @@
     }
 }
 
+void PowerSupply::analyzeVoutOVFault()
+{
+    if (statusWord & phosphor::pmbus::status_word::VOUT_OV_FAULT)
+    {
+        if (!voutOVFault)
+        {
+            log<level::ERR>(
+                fmt::format("VOUT_OV_FAULT fault: STATUS_WORD = {:#04x}, "
+                            "STATUS_MFR_SPECIFIC = {:#02x}, "
+                            "STATUS_VOUT = {:#02x}",
+                            statusWord, statusMFR, statusVout)
+                    .c_str());
+        }
+
+        voutOVFault = true;
+    }
+}
+
 void PowerSupply::analyzeTemperatureFault()
 {
     if (statusWord & phosphor::pmbus::status_word::TEMPERATURE_FAULT_WARN)
@@ -336,21 +354,7 @@
 
                 analyzeInputFault();
 
-                if (statusWord & status_word::VOUT_OV_FAULT)
-                {
-                    if (!voutOVFault)
-                    {
-                        log<level::ERR>(
-                            fmt::format(
-                                "VOUT_OV_FAULT fault: STATUS_WORD = {:#04x}, "
-                                "STATUS_MFR_SPECIFIC = {:#02x}, "
-                                "STATUS_VOUT = {:#02x}",
-                                statusWord, statusMFR, statusVout)
-                                .c_str());
-                    }
-
-                    voutOVFault = true;
-                }
+                analyzeVoutOVFault();
 
                 if (statusWord & status_word::IOUT_OC_FAULT)
                 {
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 2ceac89..aa31de3 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -504,6 +504,14 @@
     void analyzeInputFault();
 
     /**
+     * @brief Examine STATUS_WORD for VOUT being set.
+     *
+     * If VOUT is on, "An output voltage fault or warning has occurred.", and
+     * VOUT_OV_FAULT is on, there is an output over-voltage fault.
+     */
+    void analyzeVoutOVFault();
+
+    /**
      * @brief Examine STATUS_WORD for temperature fault.
      */
     void analyzeTemperatureFault();