Check in a clang-tidy

This should've been done when we first created the repo, but better late
than never.

Signed-off-by: Ed Tanous <edtanous@google.com>
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I68da1d13167ec94f9d008dea307c9f23a991d42c
diff --git a/src/erase/cryptoErase.cpp b/src/erase/cryptoErase.cpp
index d99f6bf..edc71d9 100644
--- a/src/erase/cryptoErase.cpp
+++ b/src/erase/cryptoErase.cpp
@@ -34,8 +34,7 @@
         throw ResourceNotFound();
     }
     /* cryptLoad */
-    if (cryptIface.get()->cryptLoad(cryptHandle.get(), CRYPT_LUKS2, nullptr) !=
-        0)
+    if (cryptIface->cryptLoad(cryptHandle.get(), CRYPT_LUKS2, nullptr) != 0)
     {
         lg2::error("Failed to load the key slots for destruction",
                    "REDFISH_MESSAGE_ID",
@@ -44,7 +43,7 @@
     }
 
     /* find key slots */
-    int nKeySlots = cryptIface.get()->cryptKeySlotMax(CRYPT_LUKS2);
+    int nKeySlots = cryptIface->cryptKeySlotMax(CRYPT_LUKS2);
     if (nKeySlots < 0)
     {
         lg2::error("Failed to find the max keyslots", "REDFISH_MESSAGE_ID",
@@ -64,12 +63,11 @@
     for (int i = 0; i < nKeySlots; i++)
     {
         crypt_keyslot_info ki =
-            cryptIface.get()->cryptKeySlotStatus(cryptHandle.get(), i);
+            cryptIface->cryptKeySlotStatus(cryptHandle.get(), i);
 
         if (ki == CRYPT_SLOT_ACTIVE || ki == CRYPT_SLOT_ACTIVE_LAST)
         {
-            if (cryptIface.get()->cryptKeyslotDestroy(cryptHandle.get(), i) !=
-                0)
+            if (cryptIface->cryptKeyslotDestroy(cryptHandle.get(), i) != 0)
             {
                 lg2::error(
                     "Estoraged erase failed to destroy keyslot, continuing",
diff --git a/src/erase/erase.cpp b/src/erase/erase.cpp
index 6cd45f2..40a954e 100644
--- a/src/erase/erase.cpp
+++ b/src/erase/erase.cpp
@@ -17,7 +17,7 @@
 uint64_t Erase::findSizeOfBlockDevice()
 {
     ManagedFd fd;
-    uint64_t bytes;
+    uint64_t bytes = 0;
     try
     {
         // open block dev
diff --git a/src/erase/pattern.cpp b/src/erase/pattern.cpp
index 0e510a0..5563661 100644
--- a/src/erase/pattern.cpp
+++ b/src/erase/pattern.cpp
@@ -30,8 +30,11 @@
     // static seed defines a fixed prng sequnce so it can be verified later,
     // and validated for entropy
     uint64_t currentIndex = 0;
+
+    // random number generator seeded with a constant value will
+    // generate a predictable sequence of values NOLINTNEXTLINE
     std::minstd_rand0 generator(seed);
-    std::array<std::byte, blockSize> randArr;
+    std::array<std::byte, blockSize> randArr{};
 
     ManagedFd fd =
         stdplus::fd::open(devPath, stdplus::fd::OpenAccess::WriteOnly);
@@ -65,9 +68,11 @@
 {
 
     uint64_t currentIndex = 0;
+    // random number generator seeded with a constant value will
+    // generate a predictable sequence of values NOLINTNEXTLINE
     std::minstd_rand0 generator(seed);
-    std::array<std::byte, blockSize> randArr;
-    std::array<std::byte, blockSize> readArr;
+    std::array<std::byte, blockSize> randArr{};
+    std::array<std::byte, blockSize> readArr{};
 
     ManagedFd fd =
         stdplus::fd::open(devPath, stdplus::fd::OpenAccess::ReadOnly);
diff --git a/src/erase/verifyDriveGeometry.cpp b/src/erase/verifyDriveGeometry.cpp
index 2d223a7..446bee9 100644
--- a/src/erase/verifyDriveGeometry.cpp
+++ b/src/erase/verifyDriveGeometry.cpp
@@ -22,7 +22,7 @@
                        std::to_string(ERASE_MAX_GEOMETRY));
         throw InternalFailure();
     }
-    else if (bytes < ERASE_MIN_GEOMETRY)
+    if (bytes < ERASE_MIN_GEOMETRY)
     {
         lg2::error(
             "eStorageD erase verify Geometry too small", "REDFISH_MESSAGE_ID",
@@ -31,12 +31,9 @@
             std::to_string(bytes) + "<" + std::to_string(ERASE_MIN_GEOMETRY));
         throw InternalFailure();
     }
-    else
-    {
-        lg2::info("eStorageD erase verify Geometry in range",
-                  "REDFISH_MESSAGE_ID",
-                  std::string("OpenBMC.0.1.DriveEraseSuccess"));
-    }
+
+    lg2::info("eStorageD erase verify Geometry in range", "REDFISH_MESSAGE_ID",
+              std::string("OpenBMC.0.1.DriveEraseSuccess"));
 }
 
 } // namespace estoraged
diff --git a/src/erase/zero.cpp b/src/erase/zero.cpp
index 2c0d615..2c5a6f5 100644
--- a/src/erase/zero.cpp
+++ b/src/erase/zero.cpp
@@ -51,7 +51,7 @@
         stdplus::fd::open(devPath, stdplus::fd::OpenAccess::ReadOnly);
 
     uint64_t currentIndex = 0;
-    std::array<std::byte, blockSize> readArr;
+    std::array<std::byte, blockSize> readArr{};
     const std::array<const std::byte, blockSize> blockOfZeros{};
 
     while (currentIndex < driveSize)
@@ -70,7 +70,7 @@
                        std::string("eStorageD.1.0.EraseFailure"));
             throw InternalFailure();
         }
-        if (memcmp(readArr.data(), blockOfZeros.data(), readSize))
+        if (memcmp(readArr.data(), blockOfZeros.data(), readSize) != 0)
         {
             lg2::error("Estoraged erase zeros block is not zero",
                        "REDFISH_MESSAGE_ID",