psuevent: fix clang-tidy error
clang-tidy was reporting the following error inside boost:
```
/usr/local/include/boost/asio/detail/impl/io_uring_descriptor_service.ipp:109:3: error: Called C++ object pointer is uninitialized [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
109 | io_uring_service_.register_io_object(impl.io_object_data_);
```
It isn't clear what is causing this since other applications are
using the same objects without issues. The only obvious difference
was the initialization order of some items in the class construction.
Changed the order of the class member layout and constructor and the
clang warning goes away.
Change-Id: I46270c3ab2beeba253da42a899586596b7f7cf6c
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/psu/PSUEvent.cpp b/src/psu/PSUEvent.cpp
index 353e1f1..bc04523 100644
--- a/src/psu/PSUEvent.cpp
+++ b/src/psu/PSUEvent.cpp
@@ -146,10 +146,10 @@
std::shared_ptr<bool> state, const std::string& psuName, double pollRate) :
eventInterface(std::move(eventInterface)), asserts(std::move(asserts)),
combineEvent(std::move(combineEvent)), assertState(std::move(state)),
- path(path), eventName(eventName), readState(powerState), waitTimer(io),
-
+ path(path), eventName(eventName), readState(powerState),
inputDev(io, path, boost::asio::random_access_file::read_only),
- psuName(psuName), groupEventName(groupEventName), systemBus(conn)
+ waitTimer(io), psuName(psuName), groupEventName(groupEventName),
+ systemBus(conn)
{
buffer = std::make_shared<std::array<char, 128>>();
if (pollRate > 0.0)
diff --git a/src/psu/PSUEvent.hpp b/src/psu/PSUEvent.hpp
index 75c89f2..9e17701 100644
--- a/src/psu/PSUEvent.hpp
+++ b/src/psu/PSUEvent.hpp
@@ -64,13 +64,13 @@
std::string eventName;
PowerState readState;
- boost::asio::steady_timer waitTimer;
std::shared_ptr<std::array<char, 128>> buffer;
void restartRead();
void handleResponse(const boost::system::error_code& err,
size_t bytesTransferred);
void updateValue(const int& newValue);
boost::asio::random_access_file inputDev;
+ boost::asio::steady_timer waitTimer;
std::string psuName;
std::string groupEventName;
std::string fanName;