Don't try to read GPIOs when no device path
For certain PGOOD faults, the code may try to read a GPIO off of an IO
expander to further isolate the error. If there was a problem with the
device driver detecting that IO expander, then the code was running down
a path where it would still try to read that IO expander, but using an
empty device path which would just generate extra error traces in the
journal. Avoid this by checking for this empty path and then not
reading those GPIOs.
Change-Id: I40a3e0c13e392fa58d87f53c8911eb96c9cd7f2c
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index 2b83918..d0d176c 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -358,6 +358,14 @@
// The /dev/gpiochipX device
auto device = findGPIODevice(path);
+ if (device.empty())
+ {
+ log<level::ERR>(
+ "Missing GPIO device - cannot do GPIO analysis of fault",
+ entry("ANALYSIS_TYPE=%d\n", type));
+ return errorFound;
+ }
+
// The GPIO value of the fault condition
auto polarity = std::get<ucd90160::gpioPolarityField>(gpioConfig->second);