Fix clang-tidy 14 issues
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Idb76ae375eff9a143497942013d94ca3b3252495
diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp
index e667897..c4a47bc 100644
--- a/include/CPUSensor.hpp
+++ b/include/CPUSensor.hpp
@@ -45,7 +45,7 @@
bool show;
size_t pollTime;
bool loggedInterfaceDown = false;
- uint8_t minMaxReadCounter;
+ uint8_t minMaxReadCounter{0};
int fd;
void handleResponse(const boost::system::error_code& err);
void checkThresholds(void) override;
diff --git a/include/ChassisIntrusionSensor.hpp b/include/ChassisIntrusionSensor.hpp
index 142ced3..3f2b7c8 100644
--- a/include/ChassisIntrusionSensor.hpp
+++ b/include/ChassisIntrusionSensor.hpp
@@ -30,19 +30,19 @@
std::shared_ptr<sdbusplus::asio::dbus_interface> mIface;
std::shared_ptr<sdbusplus::asio::connection> mDbusConn;
- IntrusionSensorType mType;
+ IntrusionSensorType mType{IntrusionSensorType::gpio};
// intrusion status. 0: not intruded, 1: intruded
std::string mValue = "unknown";
std::string mOldValue = "unknown";
// valid if it is PCH register via i2c
- int mBusId;
- int mSlaveAddr;
+ int mBusId{-1};
+ int mSlaveAddr{-1};
boost::asio::deadline_timer mPollTimer;
// valid if it is via GPIO
- bool mGpioInverted;
+ bool mGpioInverted{false};
std::string mPinName = "CHASSIS_INTRUSION";
gpiod::line mGpioLine;
boost::asio::posix::stream_descriptor mGpioFd;
diff --git a/include/ExternalSensor.hpp b/include/ExternalSensor.hpp
index 3ca3c8a..30147fd 100644
--- a/include/ExternalSensor.hpp
+++ b/include/ExternalSensor.hpp
@@ -56,7 +56,7 @@
std::chrono::steady_clock::time_point writeLast;
std::chrono::steady_clock::duration writeTimeout;
- bool writeAlive;
+ bool writeAlive{false};
bool writePerishable;
std::function<void(const std::chrono::steady_clock::time_point& now)>
writeHook;
diff --git a/include/NVMeSensor.hpp b/include/NVMeSensor.hpp
index a0dce78..5c70855 100644
--- a/include/NVMeSensor.hpp
+++ b/include/NVMeSensor.hpp
@@ -26,7 +26,7 @@
private:
const unsigned int scanDelayTicks = 5 * 60;
sdbusplus::asio::object_server& objServer;
- unsigned int scanDelay;
+ unsigned int scanDelay{0};
void checkThresholds(void) override;
};
diff --git a/include/PSUEvent.hpp b/include/PSUEvent.hpp
index 3a39164..e7b5c0b 100644
--- a/include/PSUEvent.hpp
+++ b/include/PSUEvent.hpp
@@ -51,7 +51,7 @@
private:
int value = 0;
int fd;
- size_t errCount;
+ size_t errCount{0};
std::string path;
std::string eventName;
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 236c6e7..078fc45 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -68,7 +68,7 @@
minValue(min), thresholds(std::move(thresholdData)),
hysteresisTrigger((max - min) * 0.01),
hysteresisPublish((max - min) * 0.0001), dbusConnection(conn),
- readState(readState), errCount(0),
+ readState(readState),
instrumentation(enableInstrumentation
? std::make_unique<SensorInstrumentation>()
: nullptr)
@@ -102,7 +102,7 @@
double hysteresisPublish;
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
PowerState readState;
- size_t errCount;
+ size_t errCount{0};
std::unique_ptr<SensorInstrumentation> instrumentation;
// This member variable provides a hook that can be used to receive