pseq: Add exists call before reading status vout

The UCD device can support rails which are not configured as voltage
rails and therefore do not have a corresponding status vout sysfs file.
Add an exists check before reading status vout to support.

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: I9855f777768397fb4582b98ef776173fcb57e51d
diff --git a/phosphor-power-sequencer/src/ucd90320_monitor.cpp b/phosphor-power-sequencer/src/ucd90320_monitor.cpp
index e2e7887..fb73ba9 100644
--- a/phosphor-power-sequencer/src/ucd90320_monitor.cpp
+++ b/phosphor-power-sequencer/src/ucd90320_monitor.cpp
@@ -366,33 +366,39 @@
         for (size_t page = 0; page < numberPages; page++)
         {
             auto statusVout = pmbusInterface.insertPageNum(STATUS_VOUT, page);
-            uint8_t vout = pmbusInterface.read(statusVout, Type::Debug);
-
-            // If any bits are on log them, though some are just warnings so
-            // they won't cause errors
-            if (vout)
+            if (pmbusInterface.exists(statusVout, Type::Debug))
             {
-                log<level::INFO>(
-                    fmt::format("STATUS_VOUT, page: {}, value: {:#04x}", page,
-                                vout)
-                        .c_str());
-            }
+                uint8_t vout = pmbusInterface.read(statusVout, Type::Debug);
 
-            // Log errors if any non-warning bits on
-            if (vout & ~status_vout::WARNING_MASK)
-            {
-                additionalData.emplace("STATUS_VOUT",
-                                       fmt::format("{:#04x}", vout));
-                additionalData.emplace("PAGE", fmt::format("{}", page));
-                additionalData.emplace("RAIL_NAME", rails[page]);
+                // If any bits are on log them, though some are just warnings so
+                // they won't cause errors
+                if (vout)
+                {
+                    log<level::INFO>(
+                        fmt::format("STATUS_VOUT, page: {}, value: {:#04x}",
+                                    page, vout)
+                            .c_str());
+                }
 
-                // Use power supply error if set and 12v rail has failed, else
-                // use voltage error
-                message =
-                    ((page == 0) && !powerSupplyError.empty())
-                        ? powerSupplyError
-                        : "xyz.openbmc_project.Power.Error.PowerSequencerVoltageFault";
-                return;
+                // Log errors if any non-warning bits on
+                if (vout & ~status_vout::WARNING_MASK)
+                {
+                    additionalData.emplace("STATUS_VOUT",
+                                           fmt::format("{:#04x}", vout));
+                    additionalData.emplace("PAGE", fmt::format("{}", page));
+                    if (page < rails.size())
+                    {
+                        additionalData.emplace("RAIL_NAME", rails[page]);
+                    }
+
+                    // Use power supply error if set and 12v rail has failed,
+                    // else use voltage error
+                    message =
+                        ((page == 0) && !powerSupplyError.empty())
+                            ? powerSupplyError
+                            : "xyz.openbmc_project.Power.Error.PowerSequencerVoltageFault";
+                    return;
+                }
             }
         }
     }