diff --git a/src/allowlist-filter.cpp b/src/allowlist-filter.cpp
index acf423c..844bf56 100644
--- a/src/allowlist-filter.cpp
+++ b/src/allowlist-filter.cpp
@@ -1,7 +1,6 @@
 #include <ipmi-allowlist.hpp>
 #include <ipmid/api.hpp>
 #include <ipmid/utils.hpp>
-#include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <xyz/openbmc_project/Control/Security/RestrictionMode/server.hpp>
 
diff --git a/src/biosconfigcommands.cpp b/src/biosconfigcommands.cpp
index 8f3baa2..92b1f41 100644
--- a/src/biosconfigcommands.cpp
+++ b/src/biosconfigcommands.cpp
@@ -184,7 +184,7 @@
     return true;
 }
 
-bool getPendingList(ipmi::Context::ptr ctx, std::string& payloadData)
+bool getPendingList(ipmi::Context::ptr& ctx, std::string& payloadData)
 {
     std::variant<PendingAttributesType> pendingAttributesData;
     boost::system::error_code ec;
@@ -358,7 +358,7 @@
     return true;
 }
 
-bool update(ipmi::Context::ptr ctx)
+bool update(ipmi::Context::ptr& ctx)
 {
     std::string payloadFilePath =
         "/var/oob/Payload" +
@@ -630,9 +630,6 @@
  **/
 static Cc InitNVOOBdata()
 {
-    FILE* fptr;
-    uint16_t size;
-
     if (!(std::filesystem::exists(biosConfigFolder)))
     {
         std::filesystem::create_directory(biosConfigFolder);
@@ -651,9 +648,9 @@
     return ipmi::ccResponseError;
 }
 
-ipmi::RspType<> ipmiOEMSetBIOSCap(ipmi::Context::ptr ctx,
-                                  uint8_t BIOSCapabilties, uint8_t reserved1,
-                                  uint8_t reserved2, uint8_t reserved3)
+ipmi::RspType<> ipmiOEMSetBIOSCap(ipmi::Context::ptr&, uint8_t BIOSCapabilties,
+                                  uint8_t reserved1, uint8_t reserved2,
+                                  uint8_t reserved3)
 {
     if (getPostCompleted())
     {
@@ -673,7 +670,7 @@
 }
 
 ipmi::RspType<uint8_t, uint8_t, uint8_t, uint8_t>
-    ipmiOEMGetBIOSCap(ipmi::Context::ptr ctx)
+    ipmiOEMGetBIOSCap(ipmi::Context::ptr&)
 {
     if (gNVOOBdata.mIsBIOSCapInitDone)
     {
@@ -686,8 +683,8 @@
     }
 }
 
-ipmi::RspType<uint32_t> ipmiOEMSetPayload(ipmi::Context::ptr ctx,
-                                          uint8_t paramSel, uint8_t payloadType,
+ipmi::RspType<uint32_t> ipmiOEMSetPayload(ipmi::Context::ptr&, uint8_t paramSel,
+                                          uint8_t payloadType,
                                           std::vector<uint8_t> payload)
 {
     uint8_t biosCapOffsetBit = 2; // BIT:1 0-OOB BIOS config not supported
@@ -917,7 +914,7 @@
 }
 
 ipmi::RspType<message::Payload>
-    ipmiOEMGetPayload(ipmi::Context::ptr ctx, uint8_t paramSel,
+    ipmiOEMGetPayload(ipmi::Context::ptr& ctx, uint8_t paramSel,
                       uint8_t payloadType, ipmi::message::Payload& payload)
 {
     //      1-OOB BIOS config is supported
@@ -1021,7 +1018,7 @@
                 }
                 std::ifstream::pos_type fileSize = ifs.tellg();
                 // Total file data within given offset
-                if (fileSize < static_cast<uint64_t>(offset))
+                if (fileSize < static_cast<int64_t>(offset))
                 {
                     phosphor::logging::log<phosphor::logging::level::ERR>(
                         "ipmiOEMGetPayload: filesize < offset");
@@ -1049,7 +1046,7 @@
                 retValue.pack(readCount);
                 retValue.pack(chkSum);
 
-                for (int i = 0; i < readCount; i++)
+                for (uint32_t i = 0; i < readCount; i++)
                 {
                     retValue.pack(Buffer.at(i));
                 }
@@ -1075,7 +1072,7 @@
 }
 
 ipmi::RspType<> ipmiOEMSetBIOSHashInfo(
-    ipmi::Context::ptr ctx, std::array<uint8_t, maxSeedSize>& pwdSeed,
+    ipmi::Context::ptr&, std::array<uint8_t, maxSeedSize>& pwdSeed,
     uint8_t algoInfo, std::array<uint8_t, maxHashSize>& adminPwdHash)
 {
     // We should not support this command after System Booted - After Exit Boot
@@ -1121,7 +1118,7 @@
 
 ipmi::RspType<std::array<uint8_t, maxSeedSize>, uint8_t,
               std::array<uint8_t, maxHashSize>>
-    ipmiOEMGetBIOSHash(ipmi::Context::ptr ctx)
+    ipmiOEMGetBIOSHash(ipmi::Context::ptr&)
 {
     nlohmann::json data = nullptr;
 
diff --git a/src/bridgingcommands.cpp b/src/bridgingcommands.cpp
index 0f4cc20..f1fa2e1 100644
--- a/src/bridgingcommands.cpp
+++ b/src/bridgingcommands.cpp
@@ -240,7 +240,7 @@
     }
 }
 
-ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr ctx,
+ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr& ctx,
                                      const uint8_t tracking,
                                      const std::vector<uint8_t>& msgData,
                                      std::vector<uint8_t>& rspData)
@@ -393,7 +393,7 @@
  **/
 ipmi::RspType<std::vector<uint8_t> // responseData
               >
-    ipmiAppSendMessage(ipmi::Context::ptr ctx, const uint4_t channelNumber,
+    ipmiAppSendMessage(ipmi::Context::ptr& ctx, const uint4_t channelNumber,
                        const bool authenticationEnabled,
                        const bool encryptionEnabled, const uint2_t tracking,
                        ipmi::message::Payload& msg)
@@ -417,10 +417,9 @@
 
     ipmi::Cc returnVal;
     std::vector<uint8_t> rspData(ipmbMaxFrameLength);
-    size_t dataLength = 0;
     std::vector<uint8_t> unpackMsg;
 
-    auto channelNo = static_cast<const uint8_t>(channelNumber);
+    auto channelNo = static_cast<uint8_t>(channelNumber);
     // Get the channel number
     switch (channelNo)
     {
@@ -433,7 +432,7 @@
             }
 
             returnVal = bridging.handleIpmbChannel(
-                ctx, static_cast<const uint8_t>(tracking), unpackMsg, rspData);
+                ctx, static_cast<uint8_t>(tracking), unpackMsg, rspData);
             break;
         // fall through to default
         case targetChannelIcmb10:
@@ -469,7 +468,7 @@
 ipmi::RspType<uint8_t,             // channelNumber
               std::vector<uint8_t> // messageData
               >
-    ipmiAppGetMessage(ipmi::Context::ptr ctx)
+    ipmiAppGetMessage(ipmi::Context::ptr& ctx)
 {
     ipmi::ChannelInfo chInfo;
 
@@ -536,7 +535,7 @@
 
 @return IPMI completion code plus Flags as response data on success.
 **/
-ipmi::RspType<std::bitset<8>> ipmiAppGetMessageFlags(ipmi::Context::ptr ctx)
+ipmi::RspType<std::bitset<8>> ipmiAppGetMessageFlags(ipmi::Context::ptr& ctx)
 {
     ipmi::ChannelInfo chInfo;
 
@@ -615,11 +614,12 @@
 
  *  @return IPMI completion code on success
  */
-ipmi::RspType<> ipmiAppClearMessageFlags(ipmi::Context::ptr ctx,
+ipmi::RspType<> ipmiAppClearMessageFlags(ipmi::Context::ptr& ctx,
                                          bool receiveMessage,
                                          bool eventMsgBufFull, bool reserved2,
                                          bool watchdogTimeout, bool reserved1,
-                                         bool oem0, bool oem1, bool oem2)
+                                         bool /* oem0 */, bool /* oem1 */,
+                                         bool /* oem2 */)
 {
     ipmi::ChannelInfo chInfo;
 
@@ -711,7 +711,7 @@
               uint8_t,                    // Record Type
               std::variant<systemEventType, oemTsEventType,
                            oemEventType>> // Record Content
-    ipmiAppReadEventMessageBuffer(ipmi::Context::ptr ctx)
+    ipmiAppReadEventMessageBuffer(ipmi::Context::ptr& ctx)
 {
     ipmi::ChannelInfo chInfo;
 
diff --git a/src/chassiscommands.cpp b/src/chassiscommands.cpp
index a452ae6..93ab200 100644
--- a/src/chassiscommands.cpp
+++ b/src/chassiscommands.cpp
@@ -249,6 +249,8 @@
             case RestorePolicy::Policy::AlwaysOn:
                 restorePolicy = 0x02;
                 break;
+            default:
+                break;
         }
     }
     catch (const std::exception& e)
@@ -499,25 +501,22 @@
     }
 
     bool chassisIntrusionActive = false;
-    try
-    {
-        constexpr const char* chassisIntrusionObj =
-            "/xyz/openbmc_project/Chassis/Intrusion";
-        constexpr const char* chassisIntrusionInf =
-            "xyz.openbmc_project.Chassis.Intrusion";
+    constexpr const char* chassisIntrusionObj =
+        "/xyz/openbmc_project/Chassis/Intrusion";
+    constexpr const char* chassisIntrusionInf =
+        "xyz.openbmc_project.Chassis.Intrusion";
 
-        std::string intrusionService;
-        boost::system::error_code ec = ipmi::getService(
-            ctx, chassisIntrusionInf, chassisIntrusionObj, intrusionService);
-
-        chassisIntrusionActive = !intrusionService.empty();
-    }
-    catch (const std::exception& e)
+    std::string intrusionService;
+    boost::system::error_code ec = ipmi::getService(
+        ctx, chassisIntrusionInf, chassisIntrusionObj, intrusionService);
+    if (ec)
     {
         log<level::ERR>("Failed to get Chassis Intrusion service",
-                        entry("ERROR=%s", e.what()));
+                        entry("ERROR=%s", ec.message().c_str()));
     }
 
+    chassisIntrusionActive = !intrusionService.empty();
+
     // This response has a lot of hard-coded, unsupported fields
     // They are set to false or 0
     constexpr bool powerOverload = false;
@@ -629,11 +628,10 @@
                                  reserved, channel);
 }
 
-ipmi::RspType<> ipmiSetFrontPanelButtonEnables(bool disablePowerButton,
-                                               bool disableResetButton,
-                                               bool disableInterruptButton,
-                                               bool disableSleepButton,
-                                               uint4_t reserved)
+ipmi::RspType<> ipmiSetFrontPanelButtonEnables(
+    bool disablePowerButton, bool disableResetButton,
+    bool disableInterruptButton, [[maybe_unused]] bool disableSleepButton,
+    uint4_t reserved)
 {
     if (reserved)
     {
diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp
index f8672fd..7e8f82f 100644
--- a/src/firmware-update.cpp
+++ b/src/firmware-update.cpp
@@ -74,8 +74,8 @@
 } // namespace ipmi
 
 static constexpr size_t imageCount = 2;
-std::array<std::array<uint8_t, imageCount>, imageCount> imgFwSecurityVersion = {
-    (0, 0), (0, 0)};
+std::array<std::array<uint8_t, imageCount>, imageCount> imgFwSecurityVersion =
+    {};
 static constexpr size_t svnActiveVerOffsetInPfm = 0x404;
 static constexpr size_t bkcActiveVerOffsetInPfm = 0x405;
 static constexpr size_t svnRecoveryVerOffsetInPfm = 0x804;
@@ -314,8 +314,8 @@
     }
 
   private:
-    size_t fsize;
     void* addr;
+    size_t fsize;
 };
 
 class FwUpdateStatusCache
@@ -578,8 +578,6 @@
 
     // callback function for capturing signal
     auto callback = [&](sdbusplus::message_t& m) {
-        bool flag = false;
-
         std::vector<
             std::pair<std::string,
                       std::vector<std::pair<std::string, ipmi::DbusVariant>>>>
@@ -721,7 +719,6 @@
 static bool transferImageFromUsb(const std::string& uri)
 {
     bool ret = false;
-    char fwpath[fwPathMaxLength];
 
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Transfer Image From USB.",
@@ -1144,7 +1141,7 @@
 
     fwRandomNumGenTs = std::chrono::steady_clock::now();
 
-    for (int i = 0; i < fwRandomNumLength; i++)
+    for (size_t i = 0; i < fwRandomNumLength; i++)
     {
         fwRandomNum[i] = dist(gen);
     }
@@ -1194,7 +1191,7 @@
     }
 
     /* Validate random number */
-    for (int i = 0; i < fwRandomNumLength; i++)
+    for (size_t i = 0; i < fwRandomNumLength; i++)
     {
         if (fwRandomNum[i] != randNum[i])
         {
@@ -1530,6 +1527,10 @@
         "Set firmware update options.");
     bool isIPMBChannel = false;
 
+    if (reserved1 || reserved2)
+    {
+        return ipmi::responseInvalidFieldRequest();
+    }
     if (checkIPMBChannel(ctx, isIPMBChannel) != ipmi::ccSuccess)
     {
         return ipmi::responseUnspecifiedError();
@@ -1558,7 +1559,7 @@
     {
         if (sha2Check)
         {
-            auto hashSize = EVP_MD_size(EVP_sha256());
+            size_t hashSize = EVP_MD_size(EVP_sha256());
             if ((*integrityCheckVal).size() != hashSize)
             {
                 phosphor::logging::log<phosphor::logging::level::DEBUG>(
@@ -1586,7 +1587,7 @@
         sha2CheckState = sha2CheckMask;
     }
     return ipmi::responseSuccess(noDowngradeState, deferRestartState,
-                                 sha2CheckState, reserved1);
+                                 sha2CheckState, uint5_t{});
 }
 
 ipmi::RspType<uint32_t>
@@ -1657,7 +1658,7 @@
     if (((fileDataLen + writeDataLen) >= sizeof(PFRImageBlock0)) &&
         (!block0Mapped))
     {
-        struct PFRImageBlock0 block0Data = {0};
+        PFRImageBlock0 block0Data{};
 
         std::ifstream inFile(firmwareBufferFile,
                              std::ios::binary | std::ios::in);
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index cb55ee2..2bcb348 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -473,7 +473,7 @@
                 // it to sample action to make tools happy.
                 action = SmActionGet::sample;
             }
-            // fall-through
+            [[fallthrough]];
         }
         case SmSignalGet::smResetButton:
         case SmSignalGet::smPowerButton:
@@ -1094,9 +1094,6 @@
         return ipmi::responseParmOutOfRange();
     }
 
-    constexpr uint8_t invalidData = 0;
-    constexpr uint8_t validData = 1;
-
     ipmi::Cc ret = writeMacToFru(ctx, dataType, ethData);
     if (ret != ipmi::ccDestinationUnavailable)
     {
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 05661fc..d0158de 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -270,6 +270,11 @@
     std::vector<uint8_t> readBuf(0);
     ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
                                          readBuf);
+    if (retI2C)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "i2cWriteRead returns non-zero");
+    }
 }
 
 } // namespace mailbox
@@ -312,11 +317,9 @@
 }
 
 // Returns the Chassis Identifier (serial #)
-ipmi_ret_t ipmiOEMGetChassisIdentifier(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                       ipmi_request_t request,
+ipmi_ret_t ipmiOEMGetChassisIdentifier(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
                                        ipmi_response_t response,
-                                       ipmi_data_len_t dataLen,
-                                       ipmi_context_t context)
+                                       ipmi_data_len_t dataLen, ipmi_context_t)
 {
     std::string serial;
     if (*dataLen != 0) // invalid request if there are extra parameters
@@ -337,10 +340,9 @@
     return IPMI_CC_RESPONSE_ERROR;
 }
 
-ipmi_ret_t ipmiOEMSetSystemGUID(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                ipmi_request_t request,
-                                ipmi_response_t response,
-                                ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetSystemGUID(ipmi_netfn_t, ipmi_cmd_t,
+                                ipmi_request_t request, ipmi_response_t,
+                                ipmi_data_len_t dataLen, ipmi_context_t)
 {
     static constexpr size_t safeBufferLength = 50;
     char buf[safeBufferLength] = {0};
@@ -429,13 +431,13 @@
     return ipmi::responseSuccess(disableResetOnSMI, 0);
 }
 
-ipmi_ret_t ipmiOEMSetBIOSID(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                            ipmi_request_t request, ipmi_response_t response,
-                            ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetBIOSID(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t request,
+                            ipmi_response_t response, ipmi_data_len_t dataLen,
+                            ipmi_context_t)
 {
     DeviceInfo* data = reinterpret_cast<DeviceInfo*>(request);
 
-    if ((*dataLen < 2) || (*dataLen != (1 + data->biosIDLength)))
+    if ((*dataLen < 2ul) || (*dataLen != (1ul + data->biosIDLength)))
     {
         *dataLen = 0;
         return IPMI_CC_REQ_DATA_LEN_INVALID;
@@ -485,9 +487,9 @@
     return true;
 }
 
-bool getHscVerInfo(ipmi::Context::ptr ctx, uint8_t& hsc0Major,
-                   uint8_t& hsc0Minor, uint8_t& hsc1Major, uint8_t& hsc1Minor,
-                   uint8_t& hsc2Major, uint8_t& hsc2Minor)
+bool getHscVerInfo(ipmi::Context::ptr&, uint8_t& hsc0Major, uint8_t& hsc0Minor,
+                   uint8_t& hsc1Major, uint8_t& hsc1Minor, uint8_t& hsc2Major,
+                   uint8_t& hsc2Minor)
 {
     std::string hscVersion;
     std::array<uint8_t, 6> hscVersions{0};
@@ -524,7 +526,7 @@
     return true;
 }
 
-bool getSwVerInfo(ipmi::Context::ptr ctx, uint8_t& bmcMajor, uint8_t& bmcMinor,
+bool getSwVerInfo(ipmi::Context::ptr& ctx, uint8_t& bmcMajor, uint8_t& bmcMinor,
                   uint8_t& meMajor, uint8_t& meMinor)
 {
     // step 1 : get BMC Major and Minor numbers from its DBUS property
@@ -571,7 +573,7 @@
                             std::array<uint8_t, 2>, std::array<uint8_t, 2>,
                             std::array<uint8_t, 2>, std::array<uint8_t, 2>>,
                  std::tuple<uint8_t, std::array<uint8_t, 2>>>>
-    ipmiOEMGetDeviceInfo(ipmi::Context::ptr ctx, uint8_t entityType,
+    ipmiOEMGetDeviceInfo(ipmi::Context::ptr& ctx, uint8_t entityType,
                          std::optional<uint8_t> countToRead,
                          std::optional<uint8_t> offset)
 {
@@ -682,9 +684,9 @@
     }
 }
 
-ipmi_ret_t ipmiOEMGetAICFRU(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                            ipmi_request_t request, ipmi_response_t response,
-                            ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi_ret_t ipmiOEMGetAICFRU(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
+                            ipmi_response_t response, ipmi_data_len_t dataLen,
+                            ipmi_context_t)
 {
     if (*dataLen != 0)
     {
@@ -701,11 +703,9 @@
     return IPMI_CC_OK;
 }
 
-ipmi_ret_t ipmiOEMGetPowerRestoreDelay(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                       ipmi_request_t request,
+ipmi_ret_t ipmiOEMGetPowerRestoreDelay(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
                                        ipmi_response_t response,
-                                       ipmi_data_len_t dataLen,
-                                       ipmi_context_t context)
+                                       ipmi_data_len_t dataLen, ipmi_context_t)
 {
     GetPowerRestoreDelayRes* resp =
         reinterpret_cast<GetPowerRestoreDelayRes*>(response);
@@ -843,10 +843,10 @@
 }
 
 ipmi::RspType<uint8_t, std::vector<uint8_t>>
-    ipmiOEMSlotIpmb(ipmi::Context::ptr ctx, uint6_t reserved1,
+    ipmiOEMSlotIpmb(ipmi::Context::ptr& ctx, uint6_t reserved1,
                     uint2_t slotNumber, uint3_t baseBoardSlotNum,
-                    uint3_t riserSlotNum, uint2_t reserved2, uint8_t targetAddr,
-                    uint8_t netFn, uint8_t cmd,
+                    [[maybe_unused]] uint3_t riserSlotNum, uint2_t reserved2,
+                    uint8_t targetAddr, uint8_t netFn, uint8_t cmd,
                     std::optional<std::vector<uint8_t>> writeData)
 {
     if (reserved1 || reserved2)
@@ -885,11 +885,9 @@
     return ipmi::responseSuccess(cc, dataReceived);
 }
 
-ipmi_ret_t ipmiOEMSetPowerRestoreDelay(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                       ipmi_request_t request,
-                                       ipmi_response_t response,
-                                       ipmi_data_len_t dataLen,
-                                       ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetPowerRestoreDelay(ipmi_netfn_t, ipmi_cmd_t,
+                                       ipmi_request_t request, ipmi_response_t,
+                                       ipmi_data_len_t dataLen, ipmi_context_t)
 {
     SetPowerRestoreDelayReq* data =
         reinterpret_cast<SetPowerRestoreDelayReq*>(request);
@@ -1071,11 +1069,9 @@
     return ipmi::responseSuccess();
 }
 
-ipmi_ret_t ipmiOEMGetShutdownPolicy(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                    ipmi_request_t request,
+ipmi_ret_t ipmiOEMGetShutdownPolicy(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
                                     ipmi_response_t response,
-                                    ipmi_data_len_t dataLen,
-                                    ipmi_context_t context)
+                                    ipmi_data_len_t dataLen, ipmi_context_t)
 {
     GetOEMShutdownPolicyRes* resp =
         reinterpret_cast<GetOEMShutdownPolicyRes*>(response);
@@ -1135,11 +1131,9 @@
     return IPMI_CC_OK;
 }
 
-ipmi_ret_t ipmiOEMSetShutdownPolicy(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                    ipmi_request_t request,
-                                    ipmi_response_t response,
-                                    ipmi_data_len_t dataLen,
-                                    ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetShutdownPolicy(ipmi_netfn_t, ipmi_cmd_t,
+                                    ipmi_request_t request, ipmi_response_t,
+                                    ipmi_data_len_t dataLen, ipmi_context_t)
 {
     uint8_t* req = reinterpret_cast<uint8_t*>(request);
     sdbusplus::com::intel::Control::server::OCOTShutdownPolicy::Policy policy =
@@ -1425,7 +1419,7 @@
  *  @param[in] userPassword - new password in 20 bytes
  *  @returns ipmi completion code.
  */
-ipmi::RspType<> ipmiOEMSetSpecialUserPassword(ipmi::Context::ptr ctx,
+ipmi::RspType<> ipmiOEMSetSpecialUserPassword(ipmi::Context::ptr& ctx,
                                               uint8_t specialUserIndex,
                                               std::vector<uint8_t> userPassword)
 {
@@ -1562,11 +1556,11 @@
     return ipmi::responseSuccess(ledstate);
 }
 
-ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(ipmi_netfn_t, ipmi_cmd_t,
                                          ipmi_request_t request,
                                          ipmi_response_t response,
                                          ipmi_data_len_t dataLen,
-                                         ipmi_context_t context)
+                                         ipmi_context_t)
 {
     CfgHostSerialReq* req = reinterpret_cast<CfgHostSerialReq*>(request);
     uint8_t* resp = reinterpret_cast<uint8_t*>(response);
@@ -1728,13 +1722,11 @@
  *
  * @return IPMI completion code.
  **/
-ipmi::RspType<> ipmiOEMSetFanConfig(uint8_t selectedFanProfile,
-
-                                    uint2_t reserved1, bool performanceMode,
-                                    uint3_t reserved2, bool setPerformanceMode,
-                                    bool setFanProfile,
-                                    std::optional<uint8_t> dimmGroupId,
-                                    std::optional<uint32_t> dimmPresenceBitmap)
+ipmi::RspType<> ipmiOEMSetFanConfig(
+    [[maybe_unused]] uint8_t selectedFanProfile, uint2_t reserved1,
+    bool performanceMode, uint3_t reserved2, bool setPerformanceMode,
+    [[maybe_unused]] bool setFanProfile, std::optional<uint8_t> dimmGroupId,
+    [[maybe_unused]] std::optional<uint32_t> dimmPresenceBitmap)
 {
     if (reserved1 || reserved2)
     {
@@ -2102,7 +2094,6 @@
     }
     else if (command == static_cast<uint8_t>(setFscParamFlags::maxPwm))
     {
-        constexpr const size_t maxDomainCount = 8;
         uint8_t requestedDomainMask = param1;
         boost::container::flat_map data = getPidConfigs();
         if (data.empty())
@@ -2307,9 +2298,10 @@
 
 using crConfigVariant = ipmi::DbusVariant;
 
-int setCRConfig(ipmi::Context::ptr ctx, const std::string& property,
+int setCRConfig(ipmi::Context::ptr& ctx, const std::string& property,
                 const crConfigVariant& value,
-                std::chrono::microseconds timeout = ipmi::IPMI_DBUS_TIMEOUT)
+                [[maybe_unused]] std::chrono::microseconds timeout =
+                    ipmi::IPMI_DBUS_TIMEOUT)
 {
     boost::system::error_code ec;
     ctx->bus->yield_method_call<void>(
@@ -2328,9 +2320,11 @@
 }
 
 int getCRConfig(
-    ipmi::Context::ptr ctx, const std::string& property, crConfigVariant& value,
+    ipmi::Context::ptr& ctx, const std::string& property,
+    crConfigVariant& value,
     const std::string& service = "xyz.openbmc_project.PSURedundancy",
-    std::chrono::microseconds timeout = ipmi::IPMI_DBUS_TIMEOUT)
+    [[maybe_unused]] std::chrono::microseconds timeout =
+        ipmi::IPMI_DBUS_TIMEOUT)
 {
     boost::system::error_code ec;
     value = ctx->bus->yield_method_call<crConfigVariant>(
@@ -2419,7 +2413,7 @@
 static const constexpr uint32_t oneMonth = 0xf53700;
 static const constexpr uint8_t userSpecific = 0x01;
 static const constexpr uint8_t crSetCompleted = 0;
-ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr ctx,
+ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr& ctx,
                                           uint8_t parameter,
                                           ipmi::message::Payload& payload)
 {
@@ -2539,7 +2533,7 @@
 }
 
 ipmi::RspType<uint8_t, std::variant<uint8_t, uint32_t, std::vector<uint8_t>>>
-    ipmiOEMGetCRConfig(ipmi::Context::ptr ctx, uint8_t parameter)
+    ipmiOEMGetCRConfig(ipmi::Context::ptr& ctx, uint8_t parameter)
 {
     crConfigVariant value;
     switch (static_cast<crParameter>(parameter))
@@ -2858,14 +2852,14 @@
             // assemble ledState
             uint64_t ledState = 0;
             bool hasError = false;
-            for (int i = 0; i < sizeof(ledStateData); i++)
+            for (size_t i = 0; i < sizeof(ledStateData); i++)
             {
                 ledState = (uint64_t)(ledState << 8);
                 ledState = (uint64_t)(ledState | (uint64_t)ledStateData[i]);
             }
             std::bitset<size> ledStateBits(ledState);
 
-            for (int group = 0; group < pinGroupMax; group++)
+            for (size_t group = 0; group < pinGroupMax; group++)
             {
                 for (int i = 0; i < groupSize; i++)
                 { // skip non-existing pins
@@ -2960,7 +2954,7 @@
  *   - special mode value - As specified in
  * xyz.openbmc_project.Control.Security.SpecialMode.interface.yaml
  */
-ipmi::RspType<uint8_t, uint8_t> ipmiGetSecurityMode(ipmi::Context::ptr ctx)
+ipmi::RspType<uint8_t, uint8_t> ipmiGetSecurityMode(ipmi::Context::ptr& ctx)
 {
     namespace securityNameSpace =
         sdbusplus::xyz::openbmc_project::Control::Security::server;
@@ -3011,7 +3005,7 @@
  *
  *  @returns IPMI completion code
  */
-ipmi::RspType<> ipmiSetSecurityMode(ipmi::Context::ptr ctx,
+ipmi::RspType<> ipmiSetSecurityMode(ipmi::Context::ptr& ctx,
                                     uint8_t restrictionMode,
                                     std::optional<uint8_t> specialMode)
 {
@@ -3499,7 +3493,8 @@
               uint8_t,               // data0, dependent on parameter
               std::optional<uint8_t> // data1, dependent on parameter
               >
-    ipmiOemGetEfiBootOptions(uint8_t parameter, uint8_t set, uint8_t block)
+    ipmiOemGetEfiBootOptions(uint8_t parameter, [[maybe_unused]] uint8_t set,
+                             [[maybe_unused]] uint8_t block)
 {
     using namespace boot_options;
     uint8_t bootOption = 0;
@@ -3684,7 +3679,7 @@
     boost::container::flat_map<std::string, BasicVariantType>;
 static constexpr const std::array<const char*, 1> psuPresenceTypes = {
     "xyz.openbmc_project.Configuration.PSUPresence"};
-int getPSUAddress(ipmi::Context::ptr ctx, uint8_t& bus,
+int getPSUAddress(ipmi::Context::ptr& ctx, uint8_t& bus,
                   std::vector<uint64_t>& addrTable)
 {
     boost::system::error_code ec;
@@ -3741,7 +3736,8 @@
 static const constexpr uint8_t defaultPSUBus = 7;
 // Second Minor, Primary Minor, Major
 static const constexpr size_t verLen = 3;
-ipmi::RspType<std::vector<uint8_t>> ipmiOEMGetPSUVersion(ipmi::Context::ptr ctx)
+ipmi::RspType<std::vector<uint8_t>>
+    ipmiOEMGetPSUVersion(ipmi::Context::ptr& ctx)
 {
     uint8_t bus = defaultPSUBus;
     std::vector<uint64_t> addrTable;
@@ -3779,7 +3775,7 @@
     return ipmi::responseSuccess(result);
 }
 
-std::optional<uint8_t> getMultiNodeInfoPresence(ipmi::Context::ptr ctx,
+std::optional<uint8_t> getMultiNodeInfoPresence(ipmi::Context::ptr& ctx,
                                                 const std::string& name)
 {
     Value dbusValue = 0;
@@ -3835,10 +3831,10 @@
               uint4_t, // reading Type
               uint16_t // reading Value
               >
-    ipmiOEMGetReading(ipmi::Context::ptr ctx, uint4_t domainId,
+    ipmiOEMGetReading(ipmi::Context::ptr& ctx, uint4_t domainId,
                       uint4_t readingType, uint16_t reserved)
 {
-    constexpr uint8_t platformPower = 0;
+    [[maybe_unused]] constexpr uint8_t platformPower = 0;
     constexpr uint8_t inletAirTemp = 1;
     constexpr uint8_t iccTdc = 2;
 
@@ -3928,49 +3924,46 @@
         case ipmi::mailbox::registerType::fifoReadRegister:
         {
             // Check if readRegister is an FIFO read register
-            if (registerIdentifier == 1)
+            if (ipmi::mailbox::readFifoReg.find(readRegister) ==
+                ipmi::mailbox::readFifoReg.end())
             {
-                if (ipmi::mailbox::readFifoReg.find(readRegister) ==
-                    ipmi::mailbox::readFifoReg.end())
-                {
-                    phosphor::logging::log<phosphor::logging::level::ERR>(
-                        "OEM IPMI command: Register is not a Read FIFO  ");
-                    return ipmi::responseInvalidFieldRequest();
-                }
-
                 phosphor::logging::log<phosphor::logging::level::ERR>(
-                    "OEM IPMI command: Register is a Read FIFO  ");
+                    "OEM IPMI command: Register is not a Read FIFO  ");
+                return ipmi::responseInvalidFieldRequest();
+            }
 
-                ipmi::mailbox::writefifo(ipmi::mailbox::provisioningCommand,
-                                         readRegister);
-                ipmi::mailbox::writefifo(ipmi::mailbox::triggerCommand,
-                                         ipmi::mailbox::flushRead);
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "OEM IPMI command: Register is a Read FIFO  ");
 
-                std::vector<uint8_t> writeData = {ipmi::mailbox::readFifo};
-                std::vector<uint8_t> readBuf(1);
-                std::vector<uint8_t> result;
+            ipmi::mailbox::writefifo(ipmi::mailbox::provisioningCommand,
+                                     readRegister);
+            ipmi::mailbox::writefifo(ipmi::mailbox::triggerCommand,
+                                     ipmi::mailbox::flushRead);
 
-                for (int i = 0; i < numOfBytes; i++)
+            std::vector<uint8_t> writeData = {ipmi::mailbox::readFifo};
+            std::vector<uint8_t> readBuf(1);
+            std::vector<uint8_t> result;
+
+            for (int i = 0; i < numOfBytes; i++)
+            {
+                ipmi::Cc ret = ipmi::i2cWriteRead(ipmi::mailbox::i2cBus,
+                                                  ipmi::mailbox::targetAddr,
+                                                  writeData, readBuf);
+                if (ret != ipmi::ccSuccess)
                 {
-                    ipmi::Cc ret = ipmi::i2cWriteRead(ipmi::mailbox::i2cBus,
-                                                      ipmi::mailbox::targetAddr,
-                                                      writeData, readBuf);
-                    if (ret != ipmi::ccSuccess)
-                    {
-                        return ipmi::response(ret);
-                    }
-
-                    else
-                    {
-                        for (const uint8_t& data : readBuf)
-                        {
-                            result.emplace_back(data);
-                        }
-                    }
+                    return ipmi::response(ret);
                 }
 
-                return ipmi::responseSuccess(result);
+                else
+                {
+                    for (const uint8_t& data : readBuf)
+                    {
+                        result.emplace_back(data);
+                    }
+                }
             }
+
+            return ipmi::responseSuccess(result);
         }
 
         case ipmi::mailbox::registerType::singleByteRegister:
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 4dc170f..95bb491 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -34,6 +34,7 @@
 #include <array>
 #include <chrono>
 #include <cmath>
+#include <cstdint>
 #include <cstring>
 #include <iostream>
 #include <map>
@@ -91,7 +92,7 @@
     *getSdBus(),
     "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
     "sensors/'",
-    [](sdbusplus::message_t& m) {
+    [](sdbusplus::message_t&) {
     sensorTree.clear();
     sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
                      std::chrono::system_clock::now().time_since_epoch())
@@ -102,7 +103,7 @@
     *getSdBus(),
     "type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
     "sensors/'",
-    [](sdbusplus::message_t& m) {
+    [](sdbusplus::message_t&) {
     sensorTree.clear();
     sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
                         std::chrono::system_clock::now().time_since_epoch())
@@ -601,12 +602,10 @@
     bool lowerCriticalThreshMask, bool lowerNonRecovThreshMask,
     bool upperNonCriticalThreshMask, bool upperCriticalThreshMask,
     bool upperNonRecovThreshMask, uint2_t reserved, uint8_t lowerNonCritical,
-    uint8_t lowerCritical, uint8_t lowerNonRecoverable,
+    uint8_t lowerCritical, [[maybe_unused]] uint8_t lowerNonRecoverable,
     uint8_t upperNonCritical, uint8_t upperCritical,
-    uint8_t upperNonRecoverable)
+    [[maybe_unused]] uint8_t upperNonRecoverable)
 {
-    constexpr uint8_t thresholdMask = 0xFF;
-
     if (sensorNum == reservedSensorNumber)
     {
         return ipmi::responseInvalidFieldRequest();
@@ -1328,7 +1327,7 @@
             "getSensorDataRecord: sensor record mismatch");
         return GENERAL_ERROR;
     }
-    get_sdr::SensorDataFullRecord record = {0};
+    get_sdr::SensorDataFullRecord record = {{}, {}, {}};
 
     get_sdr::header::set_record_id(
         recordID, reinterpret_cast<get_sdr::SensorDataRecordHeader*>(&record));
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index fac3d94..d3c862e 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -911,7 +911,6 @@
                           uint16_t timeout)
 {
     bool ret = false;
-    uint32_t u32Status = 0;
 
     if (timeout == 0)
     {
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 67ca8d8..c124235 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -295,7 +295,7 @@
     recalculateHashes();
 }
 
-ipmi::Cc getFru(ipmi::Context::ptr ctx, uint8_t devId)
+ipmi::Cc getFru(ipmi::Context::ptr& ctx, uint8_t devId)
 {
     if (lastDevId == devId && devId != 0xFF)
     {
@@ -451,7 +451,7 @@
 ipmi::RspType<uint8_t,             // Count
               std::vector<uint8_t> // Requested data
               >
-    ipmiStorageReadFruData(ipmi::Context::ptr ctx, uint8_t fruDeviceId,
+    ipmiStorageReadFruData(ipmi::Context::ptr& ctx, uint8_t fruDeviceId,
                            uint16_t fruInventoryOffset, uint8_t countToRead)
 {
     if (fruDeviceId == 0xFF)
@@ -499,7 +499,7 @@
  *   - countWritten  - Count written
  */
 ipmi::RspType<uint8_t>
-    ipmiStorageWriteFruData(ipmi::Context::ptr ctx, uint8_t fruDeviceId,
+    ipmiStorageWriteFruData(ipmi::Context::ptr& ctx, uint8_t fruDeviceId,
                             uint16_t fruInventoryOffset,
                             std::vector<uint8_t>& dataToWrite)
 {
@@ -515,7 +515,7 @@
     {
         return ipmi::response(status);
     }
-    int lastWriteAddr = fruInventoryOffset + writeLen;
+    size_t lastWriteAddr = fruInventoryOffset + writeLen;
     if (fruCache.size() < lastWriteAddr)
     {
         fruCache.resize(fruInventoryOffset + writeLen);
@@ -531,7 +531,7 @@
         FRUHeader* header = reinterpret_cast<FRUHeader*>(fruCache.data());
 
         int areaLength = 0;
-        int lastRecordStart = std::max(
+        size_t lastRecordStart = std::max(
             {header->internalOffset, header->chassisOffset, header->boardOffset,
              header->productOffset, header->multiRecordOffset});
         lastRecordStart *= 8; // header starts in are multiples of 8 bytes
@@ -608,7 +608,7 @@
  */
 ipmi::RspType<uint16_t, // inventorySize
               uint8_t>  // accessType
-    ipmiStorageGetFruInvAreaInfo(ipmi::Context::ptr ctx, uint8_t fruDeviceId)
+    ipmiStorageGetFruInvAreaInfo(ipmi::Context::ptr& ctx, uint8_t fruDeviceId)
 {
     if (fruDeviceId == 0xFF)
     {
@@ -627,18 +627,18 @@
     return ipmi::responseSuccess(fruCache.size(), accessType);
 }
 
-ipmi_ret_t getFruSdrCount(ipmi::Context::ptr ctx, size_t& count)
+ipmi::Cc getFruSdrCount(ipmi::Context::ptr&, size_t& count)
 {
     count = deviceHashes.size();
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
-ipmi_ret_t getFruSdrs(ipmi::Context::ptr ctx, size_t index,
-                      get_sdr::SensorDataFruRecord& resp)
+ipmi::Cc getFruSdrs(ipmi::Context::ptr& ctx, size_t index,
+                    get_sdr::SensorDataFruRecord& resp)
 {
     if (deviceHashes.size() < index)
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::ccInvalidFieldRequest;
     }
     auto device = deviceHashes.begin() + index;
     uint16_t& bus = device->second.first;
@@ -672,7 +672,7 @@
     });
     if (fru == frus.end())
     {
-        return IPMI_CC_RESPONSE_ERROR;
+        return ipmi::ccResponseError;
     }
 
 #ifdef USING_ENTITY_MANAGER_DECORATORS
@@ -807,7 +807,7 @@
     resp.body.deviceIDLen = name.size();
     name.copy(resp.body.deviceID, name.size());
 
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 static bool getSELLogFiles(std::vector<std::filesystem::path>& selLogFiles)
@@ -1206,7 +1206,7 @@
     return ipmi::responseSuccess(responseID);
 }
 
-ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr ctx,
+ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr&,
                                            uint16_t reservationID,
                                            const std::array<uint8_t, 3>& clr,
                                            uint8_t eraseOperation)
@@ -1283,7 +1283,7 @@
     return ipmi::responseSuccess(selTime.tv_sec);
 }
 
-ipmi::RspType<> ipmiStorageSetSELTime(uint32_t selTime)
+ipmi::RspType<> ipmiStorageSetSELTime([[maybe_unused]] uint32_t selTime)
 {
     // Set SEL Time is not supported
     return ipmi::responseInvalidCommand();
