diff --git a/oem/ibm/host-bmc/host_lamp_test.cpp b/oem/ibm/host-bmc/host_lamp_test.cpp
index 57f9610..e7485d8 100644
--- a/oem/ibm/host-bmc/host_lamp_test.cpp
+++ b/oem/ibm/host-bmc/host_lamp_test.cpp
@@ -111,9 +111,9 @@
     constexpr uint8_t effecterCount = 1;
     auto instanceId = instanceIdDb.next(mctp_eid);
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) + sizeof(effecterID) +
-                                    sizeof(effecterCount) +
-                                    sizeof(set_effecter_state_field));
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + sizeof(effecterID) + sizeof(effecterCount) +
+        sizeof(set_effecter_state_field));
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     set_effecter_state_field stateField{PLDM_REQUEST_SET,
                                         PLDM_STATE_SET_IDENTIFY_STATE_ASSERTED};
@@ -127,8 +127,9 @@
         return rc;
     }
 
-    auto setStateEffecterStatesResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto setStateEffecterStatesResponseHandler = [](mctp_eid_t /*eid*/,
+                                                    const pldm_msg* response,
+                                                    size_t respMsgLen) {
         if (!response || !respMsgLen)
         {
             error(
diff --git a/oem/ibm/host-bmc/host_lamp_test.hpp b/oem/ibm/host-bmc/host_lamp_test.hpp
index 67e5593..f5b1294 100644
--- a/oem/ibm/host-bmc/host_lamp_test.hpp
+++ b/oem/ibm/host-bmc/host_lamp_test.hpp
@@ -55,9 +55,8 @@
                  uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
                  pldm_pdr* repo,
                  pldm::requester::Handler<pldm::requester::Request>* handler) :
-        LEDGroupObj(bus, objPath.c_str()),
-        path(objPath), mctp_eid(mctp_eid), instanceIdDb(instanceIdDb),
-        pdrRepo(repo), handler(handler)
+        LEDGroupObj(bus, objPath.c_str()), path(objPath), mctp_eid(mctp_eid),
+        instanceIdDb(instanceIdDb), pdrRepo(repo), handler(handler)
     {}
 
     /** @brief Property SET Override function
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index 57b89ba..f223819 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -77,8 +77,8 @@
     pldm::utils::CustomFD xdmaFd(dmaFd);
 
     void* vgaMem;
-    vgaMem = mmap(nullptr, pageAlignedLength, PROT_READ, MAP_SHARED, xdmaFd(),
-                  0);
+    vgaMem =
+        mmap(nullptr, pageAlignedLength, PROT_READ, MAP_SHARED, xdmaFd(), 0);
     if (MAP_FAILED == vgaMem)
     {
         rc = -errno;
@@ -287,11 +287,10 @@
     }
 }
 
-void encodeGetFileResponseHandler(uint8_t instance_id, uint8_t completion_code,
-                                  uint32_t next_transfer_handle,
-                                  uint8_t transfer_flag,
-                                  const uint8_t* table_data, size_t table_size,
-                                  struct pldm_msg* msg)
+void encodeGetFileResponseHandler(
+    uint8_t instance_id, uint8_t completion_code, uint32_t next_transfer_handle,
+    uint8_t transfer_flag, const uint8_t* table_data, size_t table_size,
+    struct pldm_msg* msg)
 {
     int rc = encode_get_file_table_resp(instance_id, completion_code,
                                         next_transfer_handle, transfer_flag,
@@ -547,8 +546,8 @@
     uint8_t transferFlag = 0;
     uint8_t tableType = 0;
 
-    Response response(sizeof(pldm_msg_hdr) +
-                      PLDM_GET_FILE_TABLE_MIN_RESP_BYTES);
+    Response response(
+        sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_MIN_RESP_BYTES);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
 
     if (payloadLength != PLDM_GET_FILE_TABLE_REQ_BYTES)
@@ -787,8 +786,8 @@
         return response;
     }
 
-    auto fileDataPos = reinterpret_cast<const char*>(request->payload) +
-                       fileDataOffset;
+    auto fileDataPos =
+        reinterpret_cast<const char*>(request->payload) + fileDataOffset;
 
     std::ofstream stream(value.fsPath,
                          std::ios::in | std::ios::out | std::ios::binary);
@@ -826,9 +825,9 @@
     uint32_t offset{};
     uint32_t length{};
     uint64_t address{};
-    auto rc = decode_rw_file_by_type_memory_req(request, payloadLength,
-                                                &fileType, &fileHandle, &offset,
-                                                &length, &address);
+    auto rc = decode_rw_file_by_type_memory_req(
+        request, payloadLength, &fileType, &fileHandle, &offset, &length,
+        &address);
     if (rc != PLDM_SUCCESS)
     {
         error(
@@ -1135,8 +1134,8 @@
 
     rc = handler->newFileAvailable(length);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
-    int responseCode = encode_new_file_resp(request->hdr.instance_id, rc,
-                                            responsePtr);
+    int responseCode =
+        encode_new_file_resp(request->hdr.instance_id, rc, responsePtr);
     if (responseCode != PLDM_SUCCESS)
     {
         error(
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index dff0085..eab731b 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -174,63 +174,63 @@
         handlers.emplace(
             PLDM_READ_FILE_INTO_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFileIntoMemory(request, payloadLength);
-        });
+                return this->readFileIntoMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE_FROM_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFileFromMemory(request, payloadLength);
-        });
+                return this->writeFileFromMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE_BY_TYPE_FROM_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFileByTypeFromMemory(request, payloadLength);
-        });
+                return this->writeFileByTypeFromMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_READ_FILE_BY_TYPE_INTO_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFileByTypeIntoMemory(request, payloadLength);
-        });
+                return this->readFileByTypeIntoMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_READ_FILE_BY_TYPE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFileByType(request, payloadLength);
-        });
+                return this->readFileByType(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE_BY_TYPE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFileByType(request, payloadLength);
-        });
+                return this->writeFileByType(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_FILE_TABLE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getFileTable(request, payloadLength);
-        });
+                return this->getFileTable(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_READ_FILE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFile(request, payloadLength);
-        });
+                return this->readFile(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFile(request, payloadLength);
-        });
+                return this->writeFile(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_FILE_ACK,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->fileAck(request, payloadLength);
-        });
+                return this->fileAck(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_HOST_GET_ALERT_STATUS,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getAlertStatus(request, payloadLength);
-        });
+                return this->getAlertStatus(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_NEW_FILE_AVAILABLE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->newFileAvailable(request, payloadLength);
-        });
+                return this->newFileAvailable(request, payloadLength);
+            });
 
         resDumpMatcher = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
@@ -238,80 +238,84 @@
                 sdbusplus::bus::match::rules::argNpath(0, dumpObjPath),
             [this, hostSockFd, hostEid, instanceIdDb,
              handler](sdbusplus::message_t& msg) {
-            std::map<std::string,
-                     std::map<std::string, std::variant<std::string, uint32_t>>>
-                interfaces;
-            sdbusplus::message::object_path path;
-            msg.read(path, interfaces);
-            std::string vspstring;
-            std::string password;
+                std::map<
+                    std::string,
+                    std::map<std::string, std::variant<std::string, uint32_t>>>
+                    interfaces;
+                sdbusplus::message::object_path path;
+                msg.read(path, interfaces);
+                std::string vspstring;
+                std::string password;
 
-            for (const auto& interface : interfaces)
-            {
-                if (interface.first == resDumpEntry)
+                for (const auto& interface : interfaces)
                 {
-                    for (const auto& property : interface.second)
+                    if (interface.first == resDumpEntry)
                     {
-                        if (property.first == "VSPString")
+                        for (const auto& property : interface.second)
                         {
-                            vspstring = std::get<std::string>(property.second);
+                            if (property.first == "VSPString")
+                            {
+                                vspstring =
+                                    std::get<std::string>(property.second);
+                            }
+                            else if (property.first == "Password")
+                            {
+                                password =
+                                    std::get<std::string>(property.second);
+                            }
                         }
-                        else if (property.first == "Password")
-                        {
-                            password = std::get<std::string>(property.second);
-                        }
+                        dbusToFileHandlers
+                            .emplace_back(
+                                std::make_unique<pldm::requester::oem_ibm::
+                                                     DbusToFileHandler>(
+                                    hostSockFd, hostEid, instanceIdDb, path,
+                                    handler))
+                            ->processNewResourceDump(vspstring, password);
+                        break;
                     }
-                    dbusToFileHandlers
-                        .emplace_back(
-                            std::make_unique<
-                                pldm::requester::oem_ibm::DbusToFileHandler>(
-                                hostSockFd, hostEid, instanceIdDb, path,
-                                handler))
-                        ->processNewResourceDump(vspstring, password);
-                    break;
                 }
-            }
-        });
+            });
         vmiCertMatcher = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
             sdbusplus::bus::match::rules::interfacesAdded() +
                 sdbusplus::bus::match::rules::argNpath(0, certObjPath),
             [this, hostSockFd, hostEid, instanceIdDb,
              handler](sdbusplus::message_t& msg) {
-            std::map<std::string,
-                     std::map<std::string, std::variant<std::string, uint32_t>>>
-                interfaces;
-            sdbusplus::message::object_path path;
-            msg.read(path, interfaces);
-            std::string csr;
+                std::map<
+                    std::string,
+                    std::map<std::string, std::variant<std::string, uint32_t>>>
+                    interfaces;
+                sdbusplus::message::object_path path;
+                msg.read(path, interfaces);
+                std::string csr;
 
-            for (const auto& interface : interfaces)
-            {
-                if (interface.first == certAuthority)
+                for (const auto& interface : interfaces)
                 {
-                    for (const auto& property : interface.second)
+                    if (interface.first == certAuthority)
                     {
-                        if (property.first == "CSR")
+                        for (const auto& property : interface.second)
                         {
-                            csr = std::get<std::string>(property.second);
-                            auto fileHandle =
-                                sdbusplus::message::object_path(path)
-                                    .filename();
+                            if (property.first == "CSR")
+                            {
+                                csr = std::get<std::string>(property.second);
+                                auto fileHandle =
+                                    sdbusplus::message::object_path(path)
+                                        .filename();
 
-                            dbusToFileHandlers
-                                .emplace_back(
-                                    std::make_unique<pldm::requester::oem_ibm::
-                                                         DbusToFileHandler>(
+                                dbusToFileHandlers
+                                    .emplace_back(std::make_unique<
+                                                  pldm::requester::oem_ibm::
+                                                      DbusToFileHandler>(
                                         hostSockFd, hostEid, instanceIdDb, path,
                                         handler))
-                                ->newCsrFileAvailable(csr, fileHandle);
-                            break;
+                                    ->newCsrFileAvailable(csr, fileHandle);
+                                break;
+                            }
                         }
+                        break;
                     }
-                    break;
                 }
-            }
-        });
+            });
     }
 
     /** @brief Handler for readFileIntoMemory command
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index 1a14555..bed64f1 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -47,8 +47,8 @@
         length -= dma::maxSize;
         address += dma::maxSize;
     }
-    auto rc = xdmaInterface.transferDataHost(fd, offset, length, address,
-                                             upstream);
+    auto rc =
+        xdmaInterface.transferDataHost(fd, offset, length, address, upstream);
     return rc < 0 ? PLDM_ERROR : PLDM_SUCCESS;
 }
 
@@ -58,8 +58,8 @@
     dma::DMA xdmaInterface;
     while (length > dma::maxSize)
     {
-        auto rc = xdmaInterface.transferHostDataToSocket(fd, dma::maxSize,
-                                                         address);
+        auto rc =
+            xdmaInterface.transferHostDataToSocket(fd, dma::maxSize, address);
         if (rc < 0)
         {
             return PLDM_ERROR;
@@ -123,8 +123,8 @@
     return transferFileData(fd(), upstream, offset, length, address);
 }
 
-std::unique_ptr<FileHandler> getHandlerByType(uint16_t fileType,
-                                              uint32_t fileHandle)
+std::unique_ptr<FileHandler>
+    getHandlerByType(uint16_t fileType, uint32_t fileHandle)
 {
     switch (fileType)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.hpp b/oem/ibm/libpldmresponder/file_io_by_type.hpp
index c9056e9..cf4a82c 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.hpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.hpp
@@ -130,7 +130,7 @@
  *  @param[in] fileHandle - file handle
  */
 
-std::unique_ptr<FileHandler> getHandlerByType(uint16_t fileType,
-                                              uint32_t fileHandle);
+std::unique_ptr<FileHandler>
+    getHandlerByType(uint16_t fileType, uint32_t fileHandle);
 } // namespace responder
 } // namespace pldm
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.cpp b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
index 00d9f0b..402a003 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
@@ -163,9 +163,9 @@
             }
             PropertyValue valueStatus{
                 "xyz.openbmc_project.Certs.Entry.State.Complete"};
-            DBusMapping dbusMappingStatus{certObjPath +
-                                              std::to_string(fileHandle),
-                                          certEntryIntf, "Status", "string"};
+            DBusMapping dbusMappingStatus{
+                certObjPath + std::to_string(fileHandle), certEntryIntf,
+                "Status", "string"};
             try
             {
                 info(
@@ -231,8 +231,8 @@
     }
     else if (certType == PLDM_FILE_TYPE_ROOT_CERT)
     {
-        fileFd = open((filePath + "RootCert").c_str(), flags,
-                      S_IRUSR | S_IWUSR);
+        fileFd =
+            open((filePath + "RootCert").c_str(), flags, S_IRUSR | S_IWUSR);
     }
     if (fileFd == -1)
     {
@@ -245,11 +245,9 @@
     return PLDM_SUCCESS;
 }
 
-int CertHandler::newFileAvailableWithMetaData(uint64_t length,
-                                              uint32_t metaDataValue1,
-                                              uint32_t /*metaDataValue2*/,
-                                              uint32_t /*metaDataValue3*/,
-                                              uint32_t /*metaDataValue4*/)
+int CertHandler::newFileAvailableWithMetaData(
+    uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/,
+    uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/)
 {
     fs::create_directories(certFilePath);
     fs::permissions(certFilePath,
@@ -297,8 +295,8 @@
     }
     else if (certType == PLDM_FILE_TYPE_ROOT_CERT)
     {
-        fileFd = open((filePath + "RootCert").c_str(), flags,
-                      S_IRUSR | S_IWUSR);
+        fileFd =
+            open((filePath + "RootCert").c_str(), flags, S_IRUSR | S_IWUSR);
     }
     if (fileFd == -1)
     {
@@ -311,11 +309,10 @@
     return PLDM_SUCCESS;
 }
 
-int CertHandler::fileAckWithMetaData(uint8_t fileStatus,
-                                     uint32_t /*metaDataValue1*/,
-                                     uint32_t /*metaDataValue2*/,
-                                     uint32_t /*metaDataValue3*/,
-                                     uint32_t /*metaDataValue4*/)
+int CertHandler::fileAckWithMetaData(
+    uint8_t fileStatus, uint32_t /*metaDataValue1*/,
+    uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+    uint32_t /*metaDataValue4*/)
 {
     if (certType == PLDM_FILE_TYPE_CERT_SIGNING_REQUEST)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.hpp b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
index 75f0e69..8613cd5 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
@@ -47,17 +47,14 @@
 
     virtual int newFileAvailable(uint64_t length);
 
-    virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
-                                    uint32_t /*metaDataValue1*/,
-                                    uint32_t /*metaDataValue2*/,
-                                    uint32_t /*metaDataValue3*/,
-                                    uint32_t /*metaDataValue4*/);
+    virtual int fileAckWithMetaData(
+        uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/);
 
-    virtual int newFileAvailableWithMetaData(uint64_t length,
-                                             uint32_t metaDataValue1,
-                                             uint32_t /*metaDataValue2*/,
-                                             uint32_t /*metaDataValue3*/,
-                                             uint32_t /*metaDataValue4*/);
+    virtual int newFileAvailableWithMetaData(
+        uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/,
+        uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/);
 
     /** @brief CertHandler destructor
      */
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 40739d6..2abd726 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -122,8 +122,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(notifyObjPath,
-                                                             dumpInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(notifyObjPath, dumpInterface);
         using namespace sdbusplus::xyz::openbmc_project::Dump::server;
         auto method = bus.new_method_call(service.c_str(), notifyObjPath,
                                           dumpInterface, "Notify");
diff --git a/oem/ibm/libpldmresponder/file_io_type_lid.hpp b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
index da95907..cb0e697 100644
--- a/oem/ibm/libpldmresponder/file_io_type_lid.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
@@ -38,8 +38,8 @@
         std::stringstream stream;
         stream << std::hex << fileHandle;
         auto lidName = stream.str() + ".lid";
-        std::string patchDir = permSide ? LID_ALTERNATE_PATCH_DIR
-                                        : LID_RUNNING_PATCH_DIR;
+        std::string patchDir =
+            permSide ? LID_ALTERNATE_PATCH_DIR : LID_RUNNING_PATCH_DIR;
         auto patch = fs::path(patchDir) / lidName;
         if (fs::is_regular_file(patch))
         {
diff --git a/oem/ibm/libpldmresponder/file_io_type_pcie.cpp b/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
index 5aad55a..0c165aa 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
@@ -206,8 +206,8 @@
     };
 
     // memory map the topology file into pldm memory
-    void* fileInMemory = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE,
-                              topologyFd(), 0);
+    void* fileInMemory =
+        mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, topologyFd(), 0);
     if (MAP_FAILED == fileInMemory)
     {
         error("mmap on topology file failed with error {RC}", "RC", -errno);
@@ -354,9 +354,9 @@
              static_cast<int>(slotLocCodeCompartSize)));
         std::string slotLocationCode(slotLocation.begin(), slotLocation.end());
 
-        uint8_t* suffixData = reinterpret_cast<uint8_t*>(slotData) +
-                              slotLocationDataMemberSize +
-                              slotData->slotLocCodesCmnPrtSize;
+        uint8_t* suffixData =
+            reinterpret_cast<uint8_t*>(slotData) + slotLocationDataMemberSize +
+            slotData->slotLocCodesCmnPrtSize;
         if (!suffixData)
         {
             error("slot location suffix data is nullptr");
@@ -390,8 +390,8 @@
 
                 slotSuffixLocationCode = slotSuffLocationCode;
             }
-            std::string slotFullLocationCode = slotLocationCode +
-                                               slotSuffixLocationCode;
+            std::string slotFullLocationCode =
+                slotLocationCode + slotSuffixLocationCode;
             slotFinaLocationCode.push_back(slotFullLocationCode);
 
             // move the pointer to next slot
@@ -399,14 +399,14 @@
         }
 
         // store the information into a map
-        topologyInformation[linkId] =
-            std::make_tuple(linkStateMap[linkStatus], type, linkSpeed,
-                            linkWidth[width], pcieHostBridgeLocationCode,
-                            std::make_pair(localTopPortLocationCode,
-                                           localBottomPortLocationCode),
-                            std::make_pair(remoteTopPortLocationCode,
-                                           remoteBottomPortLocationCode),
-                            slotFinaLocationCode, parentLinkId);
+        topologyInformation[linkId] = std::make_tuple(
+            linkStateMap[linkStatus], type, linkSpeed, linkWidth[width],
+            pcieHostBridgeLocationCode,
+            std::make_pair(localTopPortLocationCode,
+                           localBottomPortLocationCode),
+            std::make_pair(remoteTopPortLocationCode,
+                           remoteBottomPortLocationCode),
+            slotFinaLocationCode, parentLinkId);
 
         // move the pointer to next link
         singleEntryData = reinterpret_cast<struct pcieLinkEntry*>(
@@ -447,8 +447,8 @@
         munmap(fileInMemory, sb.st_size);
     };
 
-    void* fileInMemory = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE,
-                              cableInfoFd(), 0);
+    void* fileInMemory =
+        mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, cableInfoFd(), 0);
 
     if (MAP_FAILED == fileInMemory)
     {
@@ -494,9 +494,9 @@
                 htobe16(cableData->ioEnclosurePortLocationCodeOffset),
             cableData->ioEnclosurePortLocationCodeSize);
 
-        std::string cablePartNum(cableDataPtr +
-                                     htobe16(cableData->cablePartNumberOffset),
-                                 cableData->cablePartNumberSize);
+        std::string cablePartNum(
+            cableDataPtr + htobe16(cableData->cablePartNumberOffset),
+            cableData->cablePartNumberSize);
 
         // cache the data into a map
         cableInformation[cable] = std::make_tuple(
diff --git a/oem/ibm/libpldmresponder/file_io_type_pcie.hpp b/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
index e6a918f..89bd2a6 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
@@ -169,20 +169,18 @@
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
 
-    virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
-                                    uint32_t /*metaDataValue1*/,
-                                    uint32_t /*metaDataValue2*/,
-                                    uint32_t /*metaDataValue3*/,
-                                    uint32_t /*metaDataValue4*/)
+    virtual int fileAckWithMetaData(
+        uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
 
-    virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
-                                             uint32_t /*metaDataValue1*/,
-                                             uint32_t /*metaDataValue2*/,
-                                             uint32_t /*metaDataValue3*/,
-                                             uint32_t /*metaDataValue4*/)
+    virtual int newFileAvailableWithMetaData(
+        uint64_t /*length*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index d33479f..685bff2 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -101,8 +101,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                             logInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         auto method = bus.new_method_call(service.c_str(), logObjPath,
                                           logInterface, "GetPEL");
         method.append(fileHandle);
@@ -132,8 +132,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                             logInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         auto method = bus.new_method_call(service.c_str(), logObjPath,
                                           logInterface, "GetPEL");
         method.append(fileHandle);
@@ -229,8 +229,8 @@
     {
         try
         {
-            service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                            logInterface);
+            service =
+                pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         }
         catch (const sdbusplus::exception_t& e)
         {
@@ -308,8 +308,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                             logInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         using namespace sdbusplus::xyz::openbmc_project::Logging::server;
         std::map<std::string, std::string> addlData{};
         auto severity =
diff --git a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
index 9c567e5..f6d9db3 100644
--- a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
@@ -27,8 +27,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(RawObjectPath,
-                                                             RawInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(RawObjectPath, RawInterface);
         auto method = bus.new_method_call(service.c_str(), RawObjectPath,
                                           FreedesktopInterface, SetMethod);
         method.append(RawInterface, RawProperty,
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
index 4ae11ac..fede599 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
@@ -31,9 +31,9 @@
         auto& bus = pldm::utils::DBusHandler::getBus();
         auto service = pldm::utils::DBusHandler().getService(keywrdObjPath,
                                                              keywrdInterface);
-        auto method = bus.new_method_call(service.c_str(), keywrdObjPath,
-                                          "org.freedesktop.DBus.Properties",
-                                          "Get");
+        auto method =
+            bus.new_method_call(service.c_str(), keywrdObjPath,
+                                "org.freedesktop.DBus.Properties", "Get");
         method.append(keywrdInterface, keywrdPropName);
         auto reply = bus.call(method, dbusTimeout);
         reply.read(keywrd);
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.hpp b/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
index 370bb08..b06c6a1 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
@@ -48,19 +48,17 @@
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
-    virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
-                                    uint32_t /*metaDataValue1*/,
-                                    uint32_t /*metaDataValue2*/,
-                                    uint32_t /*metaDataValue3*/,
-                                    uint32_t /*metaDataValue4*/)
+    virtual int fileAckWithMetaData(
+        uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
-    virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
-                                             uint32_t /*metaDataValue1*/,
-                                             uint32_t /*metaDataValue2*/,
-                                             uint32_t /*metaDataValue3*/,
-                                             uint32_t /*metaDataValue4*/)
+    virtual int newFileAvailableWithMetaData(
+        uint64_t /*length*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
diff --git a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
index 89b9f41..fe53b7a 100644
--- a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
@@ -62,12 +62,12 @@
                     return PLDM_ERROR_INVALID_DATA;
                 }
 
-                auto vendorId = std::format("0x{:04x}",
-                                            htole16(pcieData->vendorId));
-                auto deviceId = std::format("0x{:04x}",
-                                            htole16(pcieData->deviceId));
-                auto revisionId = std::format("0x{:02x}",
-                                              htole16(pcieData->revisionId));
+                auto vendorId =
+                    std::format("0x{:04x}", htole16(pcieData->vendorId));
+                auto deviceId =
+                    std::format("0x{:04x}", htole16(pcieData->deviceId));
+                auto revisionId =
+                    std::format("0x{:02x}", htole16(pcieData->revisionId));
 
                 std::string classCode = "0x";
                 for (const auto& ele : pcieData->classCode)
@@ -77,8 +77,8 @@
 
                 auto subSystemVendorId = std::format(
                     "0x{:04x}", htole16(pcieData->subSystemVendorId));
-                auto subSystemId = std::format("0x{:04x}",
-                                               htole16(pcieData->subSystemId));
+                auto subSystemId =
+                    std::format("0x{:04x}", htole16(pcieData->subSystemId));
 
                 updateDBusProperty(fruRSI, entityAssociationMap, vendorId,
                                    deviceId, revisionId, classCode,
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index 71b6ec3..d3ea1a8 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -172,8 +172,8 @@
 
         runningVersion = std::get<std::vector<std::string>>(paths)[0];
 
-        auto method1 = bus.new_method_call(mapperService, activeObjPath,
-                                           propIntf, "Get");
+        auto method1 =
+            bus.new_method_call(mapperService, activeObjPath, propIntf, "Get");
         method1.append("xyz.openbmc_project.Association", "endpoints");
 
         auto reply1 = bus.call(method1, dbusTimeout);
@@ -201,117 +201,127 @@
             pldm::utils::DBusHandler::getBus(),
             propertiesChanged(runningVersion, redundancyIntf),
             [this](sdbusplus::message_t& msg) {
-        DbusChangedProps props;
-        std::string iface;
-        msg.read(iface, props);
-        processPriorityChangeNotification(props);
-    }));
+                DbusChangedProps props;
+                std::string iface;
+                msg.read(iface, props);
+                processPriorityChangeNotification(props);
+            }));
     fwUpdateMatcher.push_back(std::make_unique<sdbusplus::bus::match_t>(
         pldm::utils::DBusHandler::getBus(),
         "interface='org.freedesktop.DBus.ObjectManager',type='signal',"
         "member='InterfacesAdded',path='/xyz/openbmc_project/software'",
         [this](sdbusplus::message_t& msg) {
-        DBusInterfaceAdded interfaces;
-        sdbusplus::message::object_path path;
-        msg.read(path, interfaces);
+            DBusInterfaceAdded interfaces;
+            sdbusplus::message::object_path path;
+            msg.read(path, interfaces);
 
-        for (auto& interface : interfaces)
-        {
-            if (interface.first == "xyz.openbmc_project.Software.Activation")
+            for (auto& interface : interfaces)
             {
-                auto imageInterface = "xyz.openbmc_project.Software.Activation";
-                auto imageObjPath = path.str.c_str();
-
-                try
+                if (interface.first ==
+                    "xyz.openbmc_project.Software.Activation")
                 {
-                    auto propVal = dBusIntf->getDbusPropertyVariant(
-                        imageObjPath, "Activation", imageInterface);
-                    const auto& imageProp = std::get<std::string>(propVal);
-                    if (imageProp == "xyz.openbmc_project.Software."
-                                     "Activation.Activations.Ready" &&
-                        isCodeUpdateInProgress())
+                    auto imageInterface =
+                        "xyz.openbmc_project.Software.Activation";
+                    auto imageObjPath = path.str.c_str();
+
+                    try
                     {
-                        newImageId = path.str;
-                        if (!imageActivationMatch)
+                        auto propVal = dBusIntf->getDbusPropertyVariant(
+                            imageObjPath, "Activation", imageInterface);
+                        const auto& imageProp = std::get<std::string>(propVal);
+                        if (imageProp == "xyz.openbmc_project.Software."
+                                         "Activation.Activations.Ready" &&
+                            isCodeUpdateInProgress())
                         {
-                            imageActivationMatch =
-                                std::make_unique<sdbusplus::bus::match_t>(
+                            newImageId = path.str;
+                            if (!imageActivationMatch)
+                            {
+                                imageActivationMatch = std::make_unique<
+                                    sdbusplus::bus::match_t>(
                                     pldm::utils::DBusHandler::getBus(),
                                     propertiesChanged(newImageId,
                                                       "xyz.openbmc_project."
                                                       "Software.Activation"),
                                     [this](sdbusplus::message_t& msg) {
-                                DbusChangedProps props;
-                                std::string iface;
-                                msg.read(iface, props);
-                                const auto itr = props.find("Activation");
-                                if (itr != props.end())
-                                {
-                                    PropertyValue value = itr->second;
-                                    auto propVal = std::get<std::string>(value);
-                                    if (propVal ==
-                                        "xyz.openbmc_project.Software."
-                                        "Activation.Activations.Active")
-                                    {
-                                        CodeUpdateState state =
-                                            CodeUpdateState::END;
-                                        setCodeUpdateProgress(false);
-                                        auto sensorId =
-                                            getFirmwareUpdateSensor();
-                                        sendStateSensorEvent(
-                                            sensorId, PLDM_STATE_SENSOR_STATE,
-                                            0, uint8_t(state),
-                                            uint8_t(CodeUpdateState::START));
-                                        newImageId.clear();
-                                    }
-                                    else if (propVal == "xyz.openbmc_project."
-                                                        "Software.Activation."
-                                                        "Activations.Failed" ||
-                                             propVal == "xyz.openbmc_"
-                                                        "project.Software."
-                                                        "Activation."
-                                                        "Activations."
-                                                        "Invalid")
-                                    {
-                                        CodeUpdateState state =
-                                            CodeUpdateState::FAIL;
-                                        setCodeUpdateProgress(false);
-                                        auto sensorId =
-                                            getFirmwareUpdateSensor();
-                                        sendStateSensorEvent(
-                                            sensorId, PLDM_STATE_SENSOR_STATE,
-                                            0, uint8_t(state),
-                                            uint8_t(CodeUpdateState::START));
-                                        newImageId.clear();
-                                    }
-                                }
-                            });
+                                        DbusChangedProps props;
+                                        std::string iface;
+                                        msg.read(iface, props);
+                                        const auto itr =
+                                            props.find("Activation");
+                                        if (itr != props.end())
+                                        {
+                                            PropertyValue value = itr->second;
+                                            auto propVal =
+                                                std::get<std::string>(value);
+                                            if (propVal ==
+                                                "xyz.openbmc_project.Software."
+                                                "Activation.Activations.Active")
+                                            {
+                                                CodeUpdateState state =
+                                                    CodeUpdateState::END;
+                                                setCodeUpdateProgress(false);
+                                                auto sensorId =
+                                                    getFirmwareUpdateSensor();
+                                                sendStateSensorEvent(
+                                                    sensorId,
+                                                    PLDM_STATE_SENSOR_STATE, 0,
+                                                    uint8_t(state),
+                                                    uint8_t(CodeUpdateState::
+                                                                START));
+                                                newImageId.clear();
+                                            }
+                                            else if (propVal ==
+                                                         "xyz.openbmc_project."
+                                                         "Software.Activation."
+                                                         "Activations.Failed" ||
+                                                     propVal ==
+                                                         "xyz.openbmc_"
+                                                         "project.Software."
+                                                         "Activation."
+                                                         "Activations."
+                                                         "Invalid")
+                                            {
+                                                CodeUpdateState state =
+                                                    CodeUpdateState::FAIL;
+                                                setCodeUpdateProgress(false);
+                                                auto sensorId =
+                                                    getFirmwareUpdateSensor();
+                                                sendStateSensorEvent(
+                                                    sensorId,
+                                                    PLDM_STATE_SENSOR_STATE, 0,
+                                                    uint8_t(state),
+                                                    uint8_t(CodeUpdateState::
+                                                                START));
+                                                newImageId.clear();
+                                            }
+                                        }
+                                    });
+                            }
+                            auto rc = setRequestedActivation();
+                            if (rc != PLDM_SUCCESS)
+                            {
+                                error("Could not set Requested Activation");
+                                CodeUpdateState state = CodeUpdateState::FAIL;
+                                setCodeUpdateProgress(false);
+                                auto sensorId = getFirmwareUpdateSensor();
+                                sendStateSensorEvent(
+                                    sensorId, PLDM_STATE_SENSOR_STATE, 0,
+                                    uint8_t(state),
+                                    uint8_t(CodeUpdateState::START));
+                            }
+                            break;
                         }
-                        auto rc = setRequestedActivation();
-                        if (rc != PLDM_SUCCESS)
-                        {
-                            error("Could not set Requested Activation");
-                            CodeUpdateState state = CodeUpdateState::FAIL;
-                            setCodeUpdateProgress(false);
-                            auto sensorId = getFirmwareUpdateSensor();
-                            sendStateSensorEvent(
-                                sensorId, PLDM_STATE_SENSOR_STATE, 0,
-                                uint8_t(state),
-                                uint8_t(CodeUpdateState::START));
-                        }
-                        break;
+                    }
+                    catch (const sdbusplus::exception_t& e)
+                    {
+                        error(
+                            "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
+                            "ERROR", e, "INTERFACE", imageInterface, "PATH",
+                            imageObjPath);
                     }
                 }
-                catch (const sdbusplus::exception_t& e)
-                {
-                    error(
-                        "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
-                        "ERROR", e, "INTERFACE", imageInterface, "PATH",
-                        imageObjPath);
-                }
             }
-        }
-    }));
+        }));
 }
 
 void CodeUpdate::processPriorityChangeNotification(
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index b7c437a..6a39328 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -312,8 +312,9 @@
         }
         std::cout << tempStream.str() << std::endl;
     }
-    auto oemPlatformEventMessageResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto oemPlatformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+                                                     const pldm_msg* response,
+                                                     size_t respMsgLen) {
         uint8_t completionCode{};
         uint8_t status{};
         auto rc = decode_platform_event_message_resp(response, respMsgLen,
@@ -369,9 +370,9 @@
     eventClass->event_state = eventState;
     eventClass->previous_event_state = prevEventState;
     auto instanceId = instanceIdDb.next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
-                                    sensorEventDataVec.size());
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+        sensorEventDataVec.size());
     auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
                              instanceId);
     if (rc != PLDM_SUCCESS)
@@ -477,51 +478,52 @@
         propertiesChanged("/xyz/openbmc_project/state/chassis0",
                           "xyz.openbmc_project.State.Chassis"),
         [this](sdbusplus::message_t& msg) {
-        DbusChangedProps props{};
-        std::string intf;
-        msg.read(intf, props);
-        const auto itr = props.find("CurrentPowerState");
-        if (itr != props.end())
-        {
-            PropertyValue value = itr->second;
-            auto propVal = std::get<std::string>(value);
-            if (propVal == "xyz.openbmc_project.State.Chassis.PowerState.Off")
+            DbusChangedProps props{};
+            std::string intf;
+            msg.read(intf, props);
+            const auto itr = props.find("CurrentPowerState");
+            if (itr != props.end())
             {
-                pldm::utils::DBusMapping dbusMapping{
-                    "/xyz/openbmc_project/control/host0/"
-                    "power_restore_policy/one_time",
-                    "xyz.openbmc_project.Control.Power.RestorePolicy",
-                    "PowerRestorePolicy", "string"};
-                value = "xyz.openbmc_project.Control.Power.RestorePolicy."
-                        "Policy.AlwaysOn";
-                try
+                PropertyValue value = itr->second;
+                auto propVal = std::get<std::string>(value);
+                if (propVal ==
+                    "xyz.openbmc_project.State.Chassis.PowerState.Off")
                 {
-                    dBusIntf->setDbusProperty(dbusMapping, value);
-                }
-                catch (const std::exception& e)
-                {
-                    error(
-                        "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
-                        "ERROR", e);
-                }
-                dbusMapping = pldm::utils::DBusMapping{
-                    "/xyz/openbmc_project/state/bmc0",
-                    "xyz.openbmc_project.State.BMC", "RequestedBMCTransition",
-                    "string"};
-                value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
-                try
-                {
-                    dBusIntf->setDbusProperty(dbusMapping, value);
-                }
-                catch (const std::exception& e)
-                {
-                    error(
-                        "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
-                        "ERROR", e);
+                    pldm::utils::DBusMapping dbusMapping{
+                        "/xyz/openbmc_project/control/host0/"
+                        "power_restore_policy/one_time",
+                        "xyz.openbmc_project.Control.Power.RestorePolicy",
+                        "PowerRestorePolicy", "string"};
+                    value = "xyz.openbmc_project.Control.Power.RestorePolicy."
+                            "Policy.AlwaysOn";
+                    try
+                    {
+                        dBusIntf->setDbusProperty(dbusMapping, value);
+                    }
+                    catch (const std::exception& e)
+                    {
+                        error(
+                            "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
+                            "ERROR", e);
+                    }
+                    dbusMapping = pldm::utils::DBusMapping{
+                        "/xyz/openbmc_project/state/bmc0",
+                        "xyz.openbmc_project.State.BMC",
+                        "RequestedBMCTransition", "string"};
+                    value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
+                    try
+                    {
+                        dBusIntf->setDbusProperty(dbusMapping, value);
+                    }
+                    catch (const std::exception& e)
+                    {
+                        error(
+                            "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
+                            "ERROR", e);
+                    }
                 }
             }
-        }
-    });
+        });
 }
 
 void pldm::responder::oem_ibm_platform::Handler::checkAndDisableWatchDog()
@@ -587,9 +589,9 @@
 void pldm::responder::oem_ibm_platform::Handler::disableWatchDogTimer()
 {
     setEventReceiverCnt = 0;
-    pldm::utils::DBusMapping dbusMapping{"/xyz/openbmc_project/watchdog/host0",
-                                         "xyz.openbmc_project.State.Watchdog",
-                                         "Enabled", "bool"};
+    pldm::utils::DBusMapping dbusMapping{
+        "/xyz/openbmc_project/watchdog/host0",
+        "xyz.openbmc_project.State.Watchdog", "Enabled", "bool"};
     bool wdStatus = watchDogRunning();
 
     if (!wdStatus)
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 8c164da..b5749c3 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -47,10 +47,9 @@
             uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
             sdeventplus::Event& event,
             pldm::requester::Handler<pldm::requester::Request>* handler) :
-        oem_platform::Handler(dBusIntf),
-        codeUpdate(codeUpdate), platformHandler(nullptr), mctp_fd(mctp_fd),
-        mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), event(event),
-        handler(handler),
+        oem_platform::Handler(dBusIntf), codeUpdate(codeUpdate),
+        platformHandler(nullptr), mctp_fd(mctp_fd), mctp_eid(mctp_eid),
+        instanceIdDb(instanceIdDb), event(event), handler(handler),
         timer(event, std::bind(std::mem_fn(&Handler::setSurvTimer), this,
                                HYPERVISOR_TID, false)),
         hostTransitioningToOff(true)
@@ -64,83 +63,84 @@
             propertiesChanged("/xyz/openbmc_project/state/host0",
                               "xyz.openbmc_project.State.Host"),
             [this](sdbusplus::message_t& msg) {
-            pldm::utils::DbusChangedProps props{};
-            std::string intf;
-            msg.read(intf, props);
-            const auto itr = props.find("CurrentHostState");
-            if (itr != props.end())
-            {
-                pldm::utils::PropertyValue value = itr->second;
-                auto propVal = std::get<std::string>(value);
-                if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
+                pldm::utils::DbusChangedProps props{};
+                std::string intf;
+                msg.read(intf, props);
+                const auto itr = props.find("CurrentHostState");
+                if (itr != props.end())
                 {
-                    hostOff = true;
-                    setEventReceiverCnt = 0;
-                    disableWatchDogTimer();
-                    startStopTimer(false);
+                    pldm::utils::PropertyValue value = itr->second;
+                    auto propVal = std::get<std::string>(value);
+                    if (propVal ==
+                        "xyz.openbmc_project.State.Host.HostState.Off")
+                    {
+                        hostOff = true;
+                        setEventReceiverCnt = 0;
+                        disableWatchDogTimer();
+                        startStopTimer(false);
+                    }
+                    else if (propVal ==
+                             "xyz.openbmc_project.State.Host.HostState.Running")
+                    {
+                        hostOff = false;
+                        hostTransitioningToOff = false;
+                    }
+                    else if (
+                        propVal ==
+                        "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
+                    {
+                        hostTransitioningToOff = true;
+                    }
                 }
-                else if (propVal ==
-                         "xyz.openbmc_project.State.Host.HostState.Running")
-                {
-                    hostOff = false;
-                    hostTransitioningToOff = false;
-                }
-                else if (
-                    propVal ==
-                    "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
-                {
-                    hostTransitioningToOff = true;
-                }
-            }
-        });
+            });
 
         powerStateOffMatch = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
             propertiesChanged("/xyz/openbmc_project/state/chassis0",
                               "xyz.openbmc_project.State.Chassis"),
             [](sdbusplus::message_t& msg) {
-            pldm::utils::DbusChangedProps props{};
-            std::string intf;
-            msg.read(intf, props);
-            const auto itr = props.find("CurrentPowerState");
-            if (itr != props.end())
-            {
-                pldm::utils::PropertyValue value = itr->second;
-                auto propVal = std::get<std::string>(value);
-                if (propVal ==
-                    "xyz.openbmc_project.State.Chassis.PowerState.Off")
+                pldm::utils::DbusChangedProps props{};
+                std::string intf;
+                msg.read(intf, props);
+                const auto itr = props.find("CurrentPowerState");
+                if (itr != props.end())
                 {
-                    static constexpr auto searchpath =
-                        "/xyz/openbmc_project/inventory/system/chassis/motherboard";
-                    int depth = 0;
-                    std::vector<std::string> powerInterface = {
-                        "xyz.openbmc_project.State.Decorator.PowerState"};
-                    pldm::utils::GetSubTreeResponse response =
-                        pldm::utils::DBusHandler().getSubtree(searchpath, depth,
-                                                              powerInterface);
-                    for (const auto& [objPath, serviceMap] : response)
+                    pldm::utils::PropertyValue value = itr->second;
+                    auto propVal = std::get<std::string>(value);
+                    if (propVal ==
+                        "xyz.openbmc_project.State.Chassis.PowerState.Off")
                     {
-                        pldm::utils::DBusMapping dbusMapping{
-                            objPath,
-                            "xyz.openbmc_project.State.Decorator.PowerState",
-                            "PowerState", "string"};
-                        value =
-                            "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
-                        try
+                        static constexpr auto searchpath =
+                            "/xyz/openbmc_project/inventory/system/chassis/motherboard";
+                        int depth = 0;
+                        std::vector<std::string> powerInterface = {
+                            "xyz.openbmc_project.State.Decorator.PowerState"};
+                        pldm::utils::GetSubTreeResponse response =
+                            pldm::utils::DBusHandler().getSubtree(
+                                searchpath, depth, powerInterface);
+                        for (const auto& [objPath, serviceMap] : response)
                         {
-                            pldm::utils::DBusHandler().setDbusProperty(
-                                dbusMapping, value);
-                        }
-                        catch (const std::exception& e)
-                        {
-                            error(
-                                "Unable to set the slot power state to Off error - {ERROR}",
-                                "ERROR", e);
+                            pldm::utils::DBusMapping dbusMapping{
+                                objPath,
+                                "xyz.openbmc_project.State.Decorator.PowerState",
+                                "PowerState", "string"};
+                            value =
+                                "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
+                            try
+                            {
+                                pldm::utils::DBusHandler().setDbusProperty(
+                                    dbusMapping, value);
+                            }
+                            catch (const std::exception& e)
+                            {
+                                error(
+                                    "Unable to set the slot power state to Off error - {ERROR}",
+                                    "ERROR", e);
+                            }
                         }
                     }
                 }
-            }
-        });
+            });
     }
 
     int getOemStateSensorReadingsHandler(
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index da9e4d3..47c1e53 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -83,8 +83,9 @@
         return rc;
     }
 
-    auto platformEventMessageResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+                                                  const pldm_msg* response,
+                                                  size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error("Failed to receive response for platform event message");
diff --git a/oem/ibm/libpldmresponder/utils.cpp b/oem/ibm/libpldmresponder/utils.cpp
index 59d418c..9fec1a1 100644
--- a/oem/ibm/libpldmresponder/utils.cpp
+++ b/oem/ibm/libpldmresponder/utils.cpp
@@ -30,8 +30,8 @@
     struct sockaddr_un addr;
     memset(&addr, 0, sizeof(addr));
     addr.sun_family = AF_UNIX;
-    size_t interfaceLength = strnlen(socketInterface.c_str(),
-                                     sizeof(addr.sun_path));
+    size_t interfaceLength =
+        strnlen(socketInterface.c_str(), sizeof(addr.sun_path));
     if (interfaceLength == sizeof(addr.sun_path))
     {
         error("Setup unix socket path '{PATH}' is too long '{LENGTH}'", "PATH",
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index 30c344d..47ddf2c 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -26,9 +26,8 @@
     int /* mctp_fd */, uint8_t mctp_eid, pldm::InstanceIdDb* instanceIdDb,
     sdbusplus::message::object_path resDumpCurrentObjPath,
     pldm::requester::Handler<pldm::requester::Request>* handler) :
-    mctp_eid(mctp_eid),
-    instanceIdDb(instanceIdDb), resDumpCurrentObjPath(resDumpCurrentObjPath),
-    handler(handler)
+    mctp_eid(mctp_eid), instanceIdDb(instanceIdDb),
+    resDumpCurrentObjPath(resDumpCurrentObjPath), handler(handler)
 {}
 
 void DbusToFileHandler::sendNewFileAvailableCmd(uint64_t fileSize)
@@ -42,15 +41,15 @@
         return;
     }
     auto instanceId = instanceIdDb->next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_NEW_FILE_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     // Need to revisit this logic at the time of multiple resource dump support
     uint32_t fileHandle = 1;
 
-    auto rc = encode_new_file_req(instanceId,
-                                  PLDM_FILE_TYPE_RESOURCE_DUMP_PARMS,
-                                  fileHandle, fileSize, request);
+    auto rc =
+        encode_new_file_req(instanceId, PLDM_FILE_TYPE_RESOURCE_DUMP_PARMS,
+                            fileHandle, fileSize, request);
     if (rc != PLDM_SUCCESS)
     {
         instanceIdDb->free(mctp_eid, instanceId);
@@ -243,9 +242,8 @@
                                PLDM_FILE_TYPE_CERT_SIGNING_REQUEST);
 }
 
-void DbusToFileHandler::newFileAvailableSendToHost(const uint32_t fileSize,
-                                                   const uint32_t fileHandle,
-                                                   const uint16_t type)
+void DbusToFileHandler::newFileAvailableSendToHost(
+    const uint32_t fileSize, const uint32_t fileHandle, const uint16_t type)
 {
     if (instanceIdDb == NULL)
     {
@@ -255,12 +253,12 @@
         return;
     }
     auto instanceId = instanceIdDb->next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_NEW_FILE_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
-    auto rc = encode_new_file_req(instanceId, type, fileHandle, fileSize,
-                                  request);
+    auto rc =
+        encode_new_file_req(instanceId, type, fileHandle, fileSize, request);
     if (rc != PLDM_SUCCESS)
     {
         instanceIdDb->free(mctp_eid, instanceId);
@@ -268,8 +266,9 @@
               "RC", rc);
         return;
     }
-    auto newFileAvailableRespHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto newFileAvailableRespHandler = [](mctp_eid_t /*eid*/,
+                                          const pldm_msg* response,
+                                          size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error(
diff --git a/oem/ibm/test/libpldmresponder_fileio_test.cpp b/oem/ibm/test/libpldmresponder_fileio_test.cpp
index 2ca1016..36c6e74 100644
--- a/oem/ibm/test/libpldmresponder_fileio_test.cpp
+++ b/oem/ibm/test/libpldmresponder_fileio_test.cpp
@@ -620,8 +620,8 @@
         requestMsg{};
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_read_file_req*>(requestMsg.data() +
-                                                         sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_read_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     request->file_handle = fileHandle;
     request->offset = offset;
@@ -668,8 +668,8 @@
         requestMsg{};
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_read_file_req*>(requestMsg.data() +
-                                                         sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_read_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     request->file_handle = fileHandle;
     request->offset = offset;
@@ -706,8 +706,8 @@
     stream.read(buffer.data(), (fileSize - request->offset));
 
     responseMsg = handler.readFile(requestMsgPtr, payload_length);
-    response = reinterpret_cast<pldm_read_file_resp*>(responseMsg.data() +
-                                                      sizeof(pldm_msg_hdr));
+    response = reinterpret_cast<pldm_read_file_resp*>(
+        responseMsg.data() + sizeof(pldm_msg_hdr));
     ASSERT_EQ(response->completion_code, PLDM_SUCCESS);
     ASSERT_EQ(response->length, (fileSize - request->offset));
     ASSERT_EQ(0, memcmp(response->file_data, buffer.data(),
@@ -724,12 +724,12 @@
     uint8_t host_eid = 0;
     int hostSocketFd = 0;
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_WRITE_FILE_REQ_BYTES + length);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES + length);
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_write_file_req*>(requestMsg.data() +
-                                                          sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_write_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     using namespace pldm::filetable;
     // Initialise the file table with 2 valid file handles 0 & 1.
@@ -773,12 +773,12 @@
     uint8_t host_eid = 0;
     int hostSocketFd = 0;
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_WRITE_FILE_REQ_BYTES + length);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES + length);
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_write_file_req*>(requestMsg.data() +
-                                                          sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_write_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     using namespace pldm::filetable;
     // Initialise the file table with 2 valid file handles 0 & 1.
diff --git a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index 21b6914..a8199f5 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -159,12 +159,12 @@
     opStateSensorEventData->present_op_state = uint8_t(CodeUpdateState::START);
     opStateSensorEventData->previous_op_state = uint8_t(CodeUpdateState::END);
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
-                                    sensorEventDataVec.size());
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+        sensorEventDataVec.size());
 
-    auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
-                             0x1);
+    auto rc =
+        encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg, 0x1);
 
     EXPECT_EQ(rc, PLDM_SUCCESS);
 }
@@ -174,8 +174,8 @@
     std::vector<uint8_t> requestMsg;
     std::vector<uint8_t> sensorEventDataVec{};
 
-    auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
-                             0x1);
+    auto rc =
+        encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg, 0x1);
 
     EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
 }
@@ -210,9 +210,9 @@
     std::unique_ptr<CodeUpdate> mockCodeUpdate =
         std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
     std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
-        std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
-                                                 mockCodeUpdate.get(), 0x1, 0x9,
-                                                 instanceIdDb, event);
+        std::make_unique<MockOemPlatformHandler>(
+            mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+            event);
     Repo inRepo(inPDRRepo);
 
     mockoemPlatformHandler->buildOEMPDR(inRepo);
@@ -316,9 +316,9 @@
     std::unique_ptr<CodeUpdate> mockCodeUpdate =
         std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
     std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
-        std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
-                                                 mockCodeUpdate.get(), 0x1, 0x9,
-                                                 instanceIdDb, event);
+        std::make_unique<MockOemPlatformHandler>(
+            mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+            event);
     Repo inRepo(inPDRRepo);
     mockoemPlatformHandler->buildOEMPDR(inRepo);
     ASSERT_EQ(inRepo.empty(), false);
@@ -415,9 +415,9 @@
     std::unique_ptr<CodeUpdate> mockCodeUpdate =
         std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
     std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
-        std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
-                                                 mockCodeUpdate.get(), 0x1, 0x9,
-                                                 instanceIdDb, event);
+        std::make_unique<MockOemPlatformHandler>(
+            mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+            event);
     std::string dbuspath = "/inventory/system1/chassis1/motherboard1/dcm0";
     mockoemPlatformHandler->updateOemDbusPaths(dbuspath);
     EXPECT_EQ(dbuspath, "/inventory/system/chassis/motherboard/dcm0");
@@ -504,8 +504,8 @@
     std::vector<std::string> cpuInterface = {"xyz.openbmc_project.Foo.Bar"};
     auto oemMockedUtils =
         std::make_unique<MockOemUtilsHandler>(&mockedDbusUtils);
-    int coreCount = oemMockedUtils->setCoreCount(entityAssociations,
-                                                 entityMaps);
+    int coreCount =
+        oemMockedUtils->setCoreCount(entityAssociations, entityMaps);
     EXPECT_EQ(coreCount, 2);
     pldm_entity_association_tree_destroy(tree);
 }
