Enable cppcoreguidelines-init-variables
We try to enforce this rule, but clearly the robot can do a better job.
Enable the rule, and for init of all variables that clang-tidy finds in
error.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Icf64bc51b3180de29f7e92fa5c5f636e6b1462a6
diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp
index 9e991e7..1c5574b 100644
--- a/src/CPUSensorMain.cpp
+++ b/src/CPUSensorMain.cpp
@@ -468,15 +468,17 @@
std::exit(EXIT_FAILURE);
}
- State newState;
- struct peci_ping_msg msg;
+ State newState = State::OFF;
+ struct peci_ping_msg msg
+ {};
msg.addr = config.addr;
if (!ioctl(file, PECI_IOC_PING, &msg))
{
bool dimmReady = false;
for (unsigned int rank = 0; rank < rankNumMax; rank++)
{
- struct peci_rd_pkg_cfg_msg msg;
+ struct peci_rd_pkg_cfg_msg msg
+ {};
msg.addr = config.addr;
msg.index = PECI_MBX_INDEX_DDR_DIMM_TEMP;
msg.param = rank;
@@ -505,10 +507,6 @@
newState = State::ON;
}
}
- else
- {
- newState = State::OFF;
- }
close(file);