diff --git a/src/fru_utils.cpp b/src/fru_utils.cpp
index 768a84d..15d4234 100644
--- a/src/fru_utils.cpp
+++ b/src/fru_utils.cpp
@@ -98,10 +98,9 @@
  * On fruDataErr, we have lost synchronisation with the length bytes, so the
  * iterator is no longer usable.
  */
-std::pair<DecodeState, std::string>
-    decodeFRUData(std::vector<uint8_t>::const_iterator& iter,
-                  const std::vector<uint8_t>::const_iterator& end,
-                  bool isLangEng)
+std::pair<DecodeState, std::string> decodeFRUData(
+    std::vector<uint8_t>::const_iterator& iter,
+    const std::vector<uint8_t>::const_iterator& end, bool isLangEng)
 {
     std::string value;
     unsigned int i = 0;
@@ -313,8 +312,8 @@
     }
 
     areaOffset *= fruBlockSize;
-    std::vector<uint8_t>::const_iterator fruBytesIter = device.begin() +
-                                                        areaOffset;
+    std::vector<uint8_t>::const_iterator fruBytesIter =
+        device.begin() + areaOffset;
 
     /* Verify area offset */
     if (!verifyOffset(device, fruAreas::fruAreaMultirecord, *fruBytesIter))
@@ -394,8 +393,8 @@
             continue;
         }
         offset *= fruBlockSize;
-        std::vector<uint8_t>::const_iterator fruBytesIter = fruBytes.begin() +
-                                                            offset;
+        std::vector<uint8_t>::const_iterator fruBytesIter =
+            fruBytes.begin() + offset;
         if (fruBytesIter + fruBlockSize >= fruBytes.end())
         {
             std::cerr << "Not enough data to parse \n";
@@ -460,9 +459,9 @@
                 isLangEng = checkLangEng(lang);
                 fruBytesIter += 1;
 
-                unsigned int minutes = *fruBytesIter |
-                                       *(fruBytesIter + 1) << 8 |
-                                       *(fruBytesIter + 2) << 16;
+                unsigned int minutes =
+                    *fruBytesIter | *(fruBytesIter + 1) << 8 |
+                    *(fruBytesIter + 2) << 16;
                 std::tm fruTime = intelEpoch();
                 std::time_t timeValue = timegm(&fruTime);
                 timeValue += static_cast<long>(minutes) * 60;
@@ -505,8 +504,8 @@
         DecodeState state = DecodeState::ok;
         do
         {
-            auto res = decodeFRUData(fruBytesIter, fruBytesIterEndArea,
-                                     isLangEng);
+            auto res =
+                decodeFRUData(fruBytesIter, fruBytesIterEndArea, isLangEng);
             state = res.first;
             std::string value = res.second;
             std::string name;
@@ -527,9 +526,8 @@
             {
                 // Strip non null characters from the end
                 value.erase(std::find_if(value.rbegin(), value.rend(),
-                                         [](char ch) {
-                    return ch != 0;
-                }).base(),
+                                         [](char ch) { return ch != 0; })
+                                .base(),
                             value.end());
 
                 result[name] = std::move(value);
@@ -551,9 +549,9 @@
             {
                 if (fieldIndex < fruAreaFieldNames->size())
                 {
-                    std::cerr << "Mandatory fields absent in FRU area "
-                              << getFruAreaName(area) << " after " << name
-                              << "\n";
+                    std::cerr
+                        << "Mandatory fields absent in FRU area "
+                        << getFruAreaName(area) << " after " << name << "\n";
                     ret = resCodes::resWarn;
                 }
             }
@@ -594,10 +592,9 @@
 // Update new fru area length &
 // Update checksum at new checksum location
 // Return the offset of the area checksum byte
-unsigned int updateFRUAreaLenAndChecksum(std::vector<uint8_t>& fruData,
-                                         size_t fruAreaStart,
-                                         size_t fruAreaEndOfFieldsOffset,
-                                         size_t fruAreaEndOffset)
+unsigned int updateFRUAreaLenAndChecksum(
+    std::vector<uint8_t>& fruData, size_t fruAreaStart,
+    size_t fruAreaEndOfFieldsOffset, size_t fruAreaEndOffset)
 {
     size_t traverseFRUAreaIndex = fruAreaEndOfFieldsOffset - fruAreaStart;
 
