Take boost error_code by reference

By convention, we should be following boost here, and passing error_code
by reference, not by value.  This makes our code consistent, and removes
the need for a copy in some cases.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id42ea4a90b6685a84818b87d1506c11256b3b9ae
diff --git a/COMMON_ERRORS.md b/COMMON_ERRORS.md
index aa4b042..70c09e3 100644
--- a/COMMON_ERRORS.md
+++ b/COMMON_ERRORS.md
@@ -210,7 +210,7 @@
 BMCWEB_ROUTE("/myendpoint/<str>",
     [](Request& req, Response& res, const std::string& id){
      crow::connections::systemBus->async_method_call(
-          [asyncResp](const boost::system::error_code ec,
+          [asyncResp](const boost::system::error_code& ec,
                       const std::string& myProperty) {
               if (ec)
               {
@@ -242,7 +242,7 @@
 BMCWEB_ROUTE("/myendpoint/<str>",
     [](Request& req, Response& res, const std::string& id){
      crow::connections::systemBus->async_method_call(
-          [asyncResp](const boost::system::error_code ec,
+          [asyncResp](const boost::system::error_code& ec,
                       const std::string& myProperty) {
               if (ec == <error code that gets returned by not found>){
                   messages::resourceNotFound(res);
diff --git a/http/http_client.hpp b/http/http_client.hpp
index c902e1a..fff261f 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -401,7 +401,7 @@
     }
 
     static void onTimeout(const std::weak_ptr<ConnectionInfo>& weakSelf,
-                          const boost::system::error_code ec)
+                          const boost::system::error_code& ec)
     {
         if (ec == boost::asio::error::operation_aborted)
         {
diff --git a/http/http_server.hpp b/http/http_server.hpp
index cc4fc22..3949a46 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -181,7 +181,7 @@
         }
         acceptor->async_accept(
             boost::beast::get_lowest_layer(connection->socket()),
-            [this, connection](boost::system::error_code ec) {
+            [this, connection](const boost::system::error_code& ec) {
             if (!ec)
             {
                 boost::asio::post(*this->ioService,
diff --git a/http/routing.hpp b/http/routing.hpp
index ae63f05..736ec38 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -1374,7 +1374,7 @@
 
         crow::connections::systemBus->async_method_call(
             [req{std::move(req)}, asyncResp, &rule, params](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& userInfoMap) mutable {
             if (ec)
             {
diff --git a/http/websocket.hpp b/http/websocket.hpp
index c36e579..f17ee5e 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -138,7 +138,7 @@
 
         // Perform the websocket upgrade
         ws.async_accept(req, [this, self(shared_from_this())](
-                                 boost::system::error_code ec) {
+                                 const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Error in ws.async_accept " << ec;
@@ -180,7 +180,7 @@
     {
         ws.async_close(
             {boost::beast::websocket::close_code::normal, msg},
-            [self(shared_from_this())](boost::system::error_code ec) {
+            [self(shared_from_this())](const boost::system::error_code& ec) {
             if (ec == boost::asio::error::operation_aborted)
             {
                 return;
diff --git a/include/async_resolve.hpp b/include/async_resolve.hpp
index 0027a05..f44be4b 100644
--- a/include/async_resolve.hpp
+++ b/include/async_resolve.hpp
@@ -37,7 +37,7 @@
         uint64_t flag = 0;
         crow::connections::systemBus->async_method_call(
             [host, port, handler{std::forward<ResolveHandler>(handler)}](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const std::vector<
                     std::tuple<int32_t, int32_t, std::vector<uint8_t>>>& resp,
                 const std::string& hostName, const uint64_t flagNum) {
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index e953a9f..f41c422 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -133,7 +133,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::forward<Callback>(callback)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::MapperGetObject& objectNames) {
         callback(!ec && !objectNames.empty());
         },
@@ -151,7 +151,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::move(callback)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const MapperGetSubTreeResponse& subtree) { callback(ec, subtree); },
         "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/object_mapper",
@@ -167,7 +167,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::move(callback)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const MapperGetSubTreePathsResponse& subtreePaths) {
         callback(ec, subtreePaths);
         },
diff --git a/include/google/google_service_root.hpp b/include/google/google_service_root.hpp
index d5d340a..cbcf15d 100644
--- a/include/google/google_service_root.hpp
+++ b/include/google/google_service_root.hpp
@@ -65,7 +65,7 @@
     const std::string& command,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& rotId, const ResolvedEntityHandler& entityHandler,
-    const boost::system::error_code ec,
+    const boost::system::error_code& ec,
     const dbus::utility::MapperGetSubTreeResponse& subtree)
 {
     if (ec)
@@ -147,7 +147,7 @@
 
 inline void
     invocationCallback(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                       const boost::system::error_code ec,
+                       const boost::system::error_code& ec,
                        const std::vector<uint8_t>& responseBytes)
 {
     if (ec)
@@ -177,7 +177,7 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp{asyncResp}](const boost::system::error_code ec,
+        [asyncResp{asyncResp}](const boost::system::error_code& ec,
                                const std::vector<uint8_t>& responseBytes) {
         invocationCallback(asyncResp, ec, responseBytes);
         },
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index f0d8bdf..ed719d5 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -19,7 +19,7 @@
 inline void installCertificate(const std::filesystem::path& certPath)
 {
     crow::connections::systemBus->async_method_call(
-        [certPath](const boost::system::error_code ec) {
+        [certPath](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "Replace Certificate Fail..";
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 500ea76..7ffa9aa 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -65,9 +65,9 @@
 
     void run()
     {
-        acceptor.async_accept(
-            [this, self(shared_from_this())](boost::system::error_code ec,
-                                             stream_protocol::socket socket) {
+        acceptor.async_accept([this, self(shared_from_this())](
+                                  const boost::system::error_code& ec,
+                                  stream_protocol::socket socket) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "UNIX socket: async_accept error = "
@@ -93,8 +93,8 @@
         });
 
         auto mountHandler =
-            [this, self(shared_from_this())](const boost::system::error_code ec,
-                                             const bool) {
+            [this, self(shared_from_this())](
+                const boost::system::error_code& ec, const bool) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "DBus error: cannot call mount method = "
@@ -130,7 +130,7 @@
         }
         // The reference to session should exists until unmount is
         // called
-        auto unmountHandler = [](const boost::system::error_code ec) {
+        auto unmountHandler = [](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "DBus error: " << ec
@@ -157,8 +157,8 @@
         // Trigger async read
         peerSocket->async_read_some(
             ux2wsBuf.prepare(nbdBufferSize),
-            [this, self(shared_from_this())](boost::system::error_code ec,
-                                             std::size_t bytesRead) {
+            [this, self(shared_from_this())](
+                const boost::system::error_code& ec, std::size_t bytesRead) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "UNIX socket: async_read_some error = "
@@ -208,8 +208,8 @@
         uxWriteInProgress = true;
         boost::asio::async_write(
             *peerSocket, ws2uxBuf.data(),
-            [this, self(shared_from_this())](boost::system::error_code ec,
-                                             std::size_t bytesWritten) {
+            [this, self(shared_from_this())](
+                const boost::system::error_code& ec, std::size_t bytesWritten) {
             ws2uxBuf.consume(bytesWritten);
             uxWriteInProgress = false;
             if (ec)
@@ -261,7 +261,7 @@
             BMCWEB_LOG_DEBUG << "nbd-proxy.onopen(" << &conn << ")";
 
             auto getUserInfoHandler =
-                [&conn](const boost::system::error_code ec,
+                [&conn](const boost::system::error_code& ec,
                         const dbus::utility::DBusPropertiesMap& userInfo) {
             if (ec)
             {
@@ -304,7 +304,7 @@
             }
 
             auto openHandler =
-                [&conn](const boost::system::error_code ec2,
+                [&conn](const boost::system::error_code& ec2,
                         const dbus::utility::ManagedObjectType& objects) {
                 const std::string* socketValue = nullptr;
                 const std::string* endpointValue = nullptr;
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 3035105..98dfb84 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -131,7 +131,7 @@
     crow::connections::systemBus->async_method_call(
         [transaction, processName{std::string(processName)},
          objectPath{std::string(objectPath)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const std::string& introspectXml) {
         if (ec)
         {
@@ -192,7 +192,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objectPath, interface,
         [asyncResp, objectPath, service,
-         interface](const boost::system::error_code ec,
+         interface](const boost::system::error_code& ec,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
         if (ec)
         {
@@ -305,7 +305,7 @@
                      << " connection_name " << connectionName;
     crow::connections::systemBus->async_method_call(
         [transaction, objectName,
-         connectionName](const boost::system::error_code ec,
+         connectionName](const boost::system::error_code& ec,
                          const dbus::utility::ManagedObjectType& objects) {
         if (ec)
         {
@@ -375,7 +375,7 @@
                      << " on connection:" << connectionName;
     crow::connections::systemBus->async_method_call(
         [transaction, objectName, connectionName](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::MapperGetAncestorsResponse& objects) {
         if (ec)
         {
@@ -1383,7 +1383,7 @@
                      << connectionName;
     crow::connections::systemBus->async_method_call(
         [transaction, connectionName{std::string(connectionName)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const std::string& introspectXml) {
         BMCWEB_LOG_DEBUG << "got xml:\n " << introspectXml;
         if (ec)
@@ -1495,7 +1495,7 @@
                         crow::connections::systemBus->async_send(
                             m,
                             [transaction,
-                             returnType](boost::system::error_code ec2,
+                             returnType](const boost::system::error_code& ec2,
                                          sdbusplus::message_t& m2) {
                             if (ec2)
                             {
@@ -1747,7 +1747,7 @@
                 m.append(interface);
                 crow::connections::systemBus->async_send(
                     m, [asyncResp, response,
-                        propertyName](const boost::system::error_code ec2,
+                        propertyName](const boost::system::error_code& ec2,
                                       sdbusplus::message_t& msg) {
                         if (ec2)
                         {
@@ -1900,7 +1900,7 @@
 
             crow::connections::systemBus->async_method_call(
                 [connectionName{std::string(connectionName)},
-                 transaction](const boost::system::error_code ec3,
+                 transaction](const boost::system::error_code& ec3,
                               const std::string& introspectXml) {
                 if (ec3)
                 {
@@ -1984,8 +1984,9 @@
                                 }
                                 crow::connections::systemBus->async_send(
                                     m,
-                                    [transaction](boost::system::error_code ec,
-                                                  sdbusplus::message_t& m2) {
+                                    [transaction](
+                                        const boost::system::error_code& ec,
+                                        sdbusplus::message_t& m2) {
                                     BMCWEB_LOG_DEBUG << "sent";
                                     if (ec)
                                     {
@@ -2157,7 +2158,7 @@
     {
         crow::connections::systemBus->async_method_call(
             [asyncResp, processName,
-             objectPath](const boost::system::error_code ec,
+             objectPath](const boost::system::error_code& ec,
                          const std::string& introspectXml) {
             if (ec)
             {
@@ -2212,7 +2213,7 @@
     {
         crow::connections::systemBus->async_method_call(
             [asyncResp, processName, objectPath,
-             interfaceName](const boost::system::error_code ec,
+             interfaceName](const boost::system::error_code& ec,
                             const std::string& introspectXml) {
             if (ec)
             {
@@ -2445,7 +2446,7 @@
         .methods(boost::beast::http::verb::get)(
             [](const crow::Request&,
                const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
-        auto myCallback = [asyncResp](const boost::system::error_code ec,
+        auto myCallback = [asyncResp](const boost::system::error_code& ec,
                                       std::vector<std::string>& names) {
             if (ec)
             {
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 080e67e..6c5cf76a 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -254,7 +254,7 @@
     {
         BMCWEB_LOG_DEBUG << "Gathering satellite configs";
         crow::connections::systemBus->async_method_call(
-            [handler](const boost::system::error_code ec,
+            [handler](const boost::system::error_code& ec,
                       const dbus::utility::ManagedObjectType& objects) {
             if (ec)
             {
diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp
index aa3bd4f..0b560f8 100644
--- a/redfish-core/include/utils/sw_utils.hpp
+++ b/redfish-core/include/utils/sw_utils.hpp
@@ -53,7 +53,7 @@
         "/xyz/openbmc_project/software/functional",
         "xyz.openbmc_project.Association", "endpoints",
         [aResp, swVersionPurpose, activeVersionPropName,
-         populateLinkToImages](const boost::system::error_code ec,
+         populateLinkToImages](const boost::system::error_code& ec,
                                const std::vector<std::string>& functionalSw) {
         BMCWEB_LOG_DEBUG << "populateSoftwareInformation enter";
         if (ec)
@@ -139,7 +139,7 @@
                     obj.first, "xyz.openbmc_project.Software.Version",
                     [aResp, swId, runningImage, swVersionPurpose,
                      activeVersionPropName, populateLinkToImages](
-                        const boost::system::error_code ec3,
+                        const boost::system::error_code& ec3,
                         const dbus::utility::DBusPropertiesMap&
                             propertiesList) {
                     if (ec3)
@@ -306,7 +306,7 @@
         "/xyz/openbmc_project/software/" + *swId,
         "xyz.openbmc_project.Software.Activation",
         [asyncResp,
-         swId](const boost::system::error_code errorCode,
+         swId](const boost::system::error_code& errorCode,
                const dbus::utility::DBusPropertiesMap& propertiesList) {
         if (errorCode)
         {
@@ -359,7 +359,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/software/updateable",
         "xyz.openbmc_project.Association", "endpoints",
-        [asyncResp, swId](const boost::system::error_code ec,
+        [asyncResp, swId](const boost::system::error_code& ec,
                           const std::vector<std::string>& objPaths) {
         if (ec)
         {
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 9a931ad..ea1571e 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -258,7 +258,7 @@
             {
                 crow::connections::systemBus->async_method_call(
                     [asyncResp, roleMapObjData, serverType,
-                     index](const boost::system::error_code ec) {
+                     index](const boost::system::error_code& ec) {
                     if (ec)
                     {
                         BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -313,7 +313,7 @@
                 {
                     crow::connections::systemBus->async_method_call(
                         [asyncResp, roleMapObjData, serverType, index,
-                         remoteGroup](const boost::system::error_code ec) {
+                         remoteGroup](const boost::system::error_code& ec) {
                         if (ec)
                         {
                             BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -337,7 +337,7 @@
                 {
                     crow::connections::systemBus->async_method_call(
                         [asyncResp, roleMapObjData, serverType, index,
-                         localRole](const boost::system::error_code ec) {
+                         localRole](const boost::system::error_code& ec) {
                         if (ec)
                         {
                             BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -392,7 +392,7 @@
 
                 crow::connections::systemBus->async_method_call(
                     [asyncResp, serverType, localRole,
-                     remoteGroup](const boost::system::error_code ec) {
+                     remoteGroup](const boost::system::error_code& ec) {
                     if (ec)
                     {
                         BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -442,7 +442,7 @@
         std::string service = resp.begin()->first;
         crow::connections::systemBus->async_method_call(
             [callback,
-             ldapType](const boost::system::error_code errorCode,
+             ldapType](const boost::system::error_code& errorCode,
                        const dbus::utility::ManagedObjectType& ldapObjects) {
             LDAPConfigData confData{};
             if (errorCode)
@@ -665,7 +665,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, ldapServerElementName,
-         serviceAddressList](const boost::system::error_code ec) {
+         serviceAddressList](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG
@@ -705,7 +705,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, username,
-         ldapServerElementName](const boost::system::error_code ec) {
+         ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Error occurred in updating the username";
@@ -738,7 +738,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, password,
-         ldapServerElementName](const boost::system::error_code ec) {
+         ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Error occurred in updating the password";
@@ -772,7 +772,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, baseDNList,
-         ldapServerElementName](const boost::system::error_code ec) {
+         ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Error Occurred in Updating the base DN";
@@ -812,7 +812,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, userNameAttribute,
-         ldapServerElementName](const boost::system::error_code ec) {
+         ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
@@ -847,7 +847,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, groupsAttribute,
-         ldapServerElementName](const boost::system::error_code ec) {
+         ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
@@ -881,7 +881,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, serviceEnabled,
-         ldapServerElementName](const boost::system::error_code ec) {
+         ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Error Occurred in Updating the service enable";
@@ -1203,7 +1203,7 @@
             if (enabled)
             {
                 crow::connections::systemBus->async_method_call(
-                    [asyncResp](const boost::system::error_code ec) {
+                    [asyncResp](const boost::system::error_code& ec) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1230,7 +1230,7 @@
                 }
 
                 crow::connections::systemBus->async_method_call(
-                    [asyncResp](const boost::system::error_code ec) {
+                    [asyncResp](const boost::system::error_code& ec) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1258,7 +1258,7 @@
                 }
 
                 crow::connections::systemBus->async_method_call(
-                    [asyncResp](const boost::system::error_code ec) {
+                    [asyncResp](const boost::system::error_code& ec) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1337,7 +1337,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, "xyz.openbmc_project.User.Manager",
         "/xyz/openbmc_project/user", "xyz.openbmc_project.User.AccountPolicy",
-        [asyncResp](const boost::system::error_code ec,
+        [asyncResp](const boost::system::error_code& ec,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
         if (ec)
         {
@@ -1424,7 +1424,7 @@
     if (minPasswordLength)
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 messages::internalError(asyncResp->res);
@@ -1472,7 +1472,7 @@
     if (unlockTimeout)
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 messages::internalError(asyncResp->res);
@@ -1488,7 +1488,7 @@
     if (lockoutThreshold)
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 messages::internalError(asyncResp->res);
@@ -1541,7 +1541,7 @@
     }
     crow::connections::systemBus->async_method_call(
         [asyncResp, thisUser, effectiveUserPrivileges](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::ManagedObjectType& users) {
         if (ec)
         {
@@ -1621,7 +1621,7 @@
         "/xyz/openbmc_project/user", "xyz.openbmc_project.User.Manager",
         "AllGroups",
         [asyncResp, username, password{std::move(password)}, roleId,
-         enabled](const boost::system::error_code ec,
+         enabled](const boost::system::error_code& ec,
                   const std::vector<std::string>& allGroupsList) {
         if (ec)
         {
@@ -1637,8 +1637,8 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, username, password](const boost::system::error_code ec2,
-                                            sdbusplus::message_t& m) {
+            [asyncResp, username, password](
+                const boost::system::error_code& ec2, sdbusplus::message_t& m) {
             if (ec2)
             {
                 userErrorMessageHandler(m.get_error(), asyncResp, username, "");
@@ -1656,7 +1656,8 @@
                 const std::string userPath(tempObjPath);
 
                 crow::connections::systemBus->async_method_call(
-                    [asyncResp, password](const boost::system::error_code ec3) {
+                    [asyncResp,
+                     password](const boost::system::error_code& ec3) {
                     if (ec3)
                     {
                         messages::internalError(asyncResp->res);
@@ -1736,7 +1737,7 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp,
-         accountName](const boost::system::error_code ec,
+         accountName](const boost::system::error_code& ec,
                       const dbus::utility::ManagedObjectType& users) {
         if (ec)
         {
@@ -1891,7 +1892,7 @@
     const std::string userPath(tempObjPath);
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, username](const boost::system::error_code ec) {
+        [asyncResp, username](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::resourceNotFound(asyncResp->res, "ManagerAccount",
@@ -1979,7 +1980,7 @@
     crow::connections::systemBus->async_method_call(
         [asyncResp, username, password(std::move(password)),
          roleId(std::move(roleId)), enabled, newUser{std::string(*newUserName)},
-         locked](const boost::system::error_code ec, sdbusplus::message_t& m) {
+         locked](const boost::system::error_code& ec, sdbusplus::message_t& m) {
         if (ec)
         {
             userErrorMessageHandler(m.get_error(), asyncResp, newUser,
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 74a22d4..1153516 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -71,7 +71,7 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec;
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 0fc36b4..423ea9d 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -24,7 +24,7 @@
  */
 inline void
     fillCableProperties(crow::Response& resp,
-                        const boost::system::error_code ec,
+                        const boost::system::error_code& ec,
                         const dbus::utility::DBusPropertiesMap& properties)
 {
     if (ec)
@@ -97,7 +97,7 @@
                 *crow::connections::systemBus, service, cableObjectPath,
                 interface,
                 [asyncResp](
-                    const boost::system::error_code ec,
+                    const boost::system::error_code& ec,
                     const dbus::utility::DBusPropertiesMap& properties) {
                 fillCableProperties(asyncResp->res, ec, properties);
                 });
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 93cb366..178e38d 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -299,7 +299,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objectPath, certs::certPropIntf,
         [asyncResp, certURL, certId,
-         name](const boost::system::error_code ec,
+         name](const boost::system::error_code& ec,
                const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -383,7 +383,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp,
-         id{objectPath.filename()}](const boost::system::error_code ec) {
+         id{objectPath.filename()}](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::resourceNotFound(asyncResp->res, "Certificate", id);
@@ -551,7 +551,7 @@
         std::make_shared<CertificateFile>(certificate);
     crow::connections::systemBus->async_method_call(
         [asyncResp, certFile, objectPath, service, url{*parsedUrl}, id,
-         name](const boost::system::error_code ec) {
+         name](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -593,7 +593,7 @@
                      << " CSRObjectPath=" << csrObjPath
                      << " service=" << service;
     crow::connections::systemBus->async_method_call(
-        [asyncResp, certURI](const boost::system::error_code ec,
+        [asyncResp, certURI](const boost::system::error_code& ec,
                              const std::string& csr) {
         if (ec)
         {
@@ -831,7 +831,7 @@
         }
         });
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec, const std::string&) {
+        [asyncResp](const boost::system::error_code& ec, const std::string&) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error: " << ec.message();
@@ -922,7 +922,7 @@
         std::make_shared<CertificateFile>(certFileBody);
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, certFile](const boost::system::error_code ec,
+        [asyncResp, certFile](const boost::system::error_code& ec,
                               const std::string& objectPath) {
         if (ec)
         {
@@ -1029,7 +1029,7 @@
         std::make_shared<CertificateFile>(certFileBody);
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, certFile](const boost::system::error_code ec,
+        [asyncResp, certFile](const boost::system::error_code& ec,
                               const std::string& objectPath) {
         if (ec)
         {
@@ -1150,7 +1150,7 @@
     std::shared_ptr<CertificateFile> certFile =
         std::make_shared<CertificateFile>(certFileBody);
     crow::connections::systemBus->async_method_call(
-        [asyncResp, certFile](const boost::system::error_code ec,
+        [asyncResp, certFile](const boost::system::error_code& ec,
                               const std::string& objectPath) {
         if (ec)
         {
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 4db6719..4701af4 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -49,7 +49,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.Chassis",
         "/xyz/openbmc_project/state/chassis0",
         "xyz.openbmc_project.State.Chassis", "CurrentPowerState",
-        [aResp{std::move(aResp)}](const boost::system::error_code ec,
+        [aResp{std::move(aResp)}](const boost::system::error_code& ec,
                                   const std::string& chassisState) {
         if (ec)
         {
@@ -90,7 +90,7 @@
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Chassis.Intrusion", "Status",
-        [aResp{std::move(aResp)}](const boost::system::error_code ec,
+        [aResp{std::move(aResp)}](const boost::system::error_code& ec,
                                   const std::string& value) {
         if (ec)
         {
@@ -176,7 +176,7 @@
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
-        [asyncResp](const boost::system::error_code ec,
+        [asyncResp](const boost::system::error_code& ec,
                     const std::string& property) {
         if (ec)
         {
@@ -197,7 +197,7 @@
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Common.UUID", "UUID",
-        [asyncResp](const boost::system::error_code ec,
+        [asyncResp](const boost::system::error_code& ec,
                     const std::string& chassisUUID) {
         if (ec)
         {
@@ -254,7 +254,7 @@
                 *crow::connections::systemBus,
                 "xyz.openbmc_project.ObjectMapper", path + "/all_sensors",
                 "xyz.openbmc_project.Association", "endpoints",
-                [health](const boost::system::error_code ec2,
+                [health](const boost::system::error_code& ec2,
                          const std::vector<std::string>& resp) {
                 if (ec2)
                 {
@@ -294,7 +294,7 @@
                 *crow::connections::systemBus,
                 "xyz.openbmc_project.ObjectMapper", path + "/drive",
                 "xyz.openbmc_project.Association", "endpoints",
-                [asyncResp, chassisId](const boost::system::error_code ec3,
+                [asyncResp, chassisId](const boost::system::error_code& ec3,
                                        const std::vector<std::string>& resp) {
                 if (ec3 || resp.empty())
                 {
@@ -324,7 +324,7 @@
                     *crow::connections::systemBus, connectionName, path,
                     assetTagInterface, "AssetTag",
                     [asyncResp, chassisId(std::string(chassisId))](
-                        const boost::system::error_code ec2,
+                        const boost::system::error_code& ec2,
                         const std::string& property) {
                     if (ec2)
                     {
@@ -351,7 +351,7 @@
                 *crow::connections::systemBus, connectionName, path,
                 "xyz.openbmc_project.Inventory.Decorator.Asset",
                 [asyncResp, chassisId(std::string(chassisId))](
-                    const boost::system::error_code /*ec2*/,
+                    const boost::system::error_code& /*ec2*/,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
                 const std::string* partNumber = nullptr;
                 const std::string* serialNumber = nullptr;
@@ -512,7 +512,7 @@
     dbus::utility::getSubTree(
         "/xyz/openbmc_project/inventory", 0, interfaces,
         [asyncResp, chassisId, locationIndicatorActive,
-         indicatorLed](const boost::system::error_code ec,
+         indicatorLed](const boost::system::error_code& ec,
                        const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
@@ -643,7 +643,7 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec2) {
+            [asyncResp](const boost::system::error_code& ec2) {
             // Use "Set" method to set the property value.
             if (ec2)
             {
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 8cdb7e0..64dc204 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -638,7 +638,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -654,7 +654,7 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -684,7 +684,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     auto createIpHandler =
-        [asyncResp, ifaceId, gateway](const boost::system::error_code ec) {
+        [asyncResp, ifaceId, gateway](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -722,7 +722,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, ifaceId, address, prefixLength,
-         gateway](const boost::system::error_code ec) {
+         gateway](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -730,7 +730,8 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, ifaceId, gateway](const boost::system::error_code ec2) {
+            [asyncResp, ifaceId,
+             gateway](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 messages::internalError(asyncResp->res);
@@ -762,7 +763,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -792,13 +793,13 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, ifaceId, address,
-         prefixLength](const boost::system::error_code ec) {
+         prefixLength](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
         }
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec2) {
+            [asyncResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 messages::internalError(asyncResp->res);
@@ -829,7 +830,7 @@
                        const std::string& address,
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    auto createIpHandler = [asyncResp](const boost::system::error_code ec) {
+    auto createIpHandler = [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -860,7 +861,7 @@
     crow::connections::systemBus->async_method_call(
         [ethifaceId{std::string{ethifaceId}},
          callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code errorCode,
+            const boost::system::error_code& errorCode,
             const dbus::utility::ManagedObjectType& resp) {
         EthernetInterfaceData ethData{};
         boost::container::flat_set<IPv4AddressData> ipv4Data;
@@ -910,7 +911,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code errorCode,
+            const boost::system::error_code& errorCode,
             dbus::utility::ManagedObjectType& resp) {
         // Callback requires vector<string> to retrieve all available
         // ethernet interfaces
@@ -963,7 +964,7 @@
         return;
     }
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -982,7 +983,7 @@
     sdbusplus::message::object_path objPath =
         "/xyz/openbmc_project/network/" + ifaceId;
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -1001,7 +1002,7 @@
 {
     std::vector<std::string> vectorDomainname = {domainname};
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -1082,7 +1083,7 @@
         "xyz.openbmc_project.Common.Error.NotAllowed";
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, macAddress](const boost::system::error_code ec,
+        [asyncResp, macAddress](const boost::system::error_code& ec,
                                 const sdbusplus::message_t& msg) {
         if (ec)
         {
@@ -1115,7 +1116,7 @@
 {
     const std::string dhcp = getDhcpEnabledEnumeration(v4Value, v6Value);
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1136,7 +1137,7 @@
     const bool& value, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1156,7 +1157,7 @@
 {
     BMCWEB_LOG_DEBUG << propertyName << " = " << value;
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1490,7 +1491,7 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -2109,7 +2110,7 @@
                 if (vlanEnable)
                 {
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec) {
+                        [asyncResp](const boost::system::error_code& ec) {
                         if (ec)
                         {
                             messages::internalError(asyncResp->res);
@@ -2165,7 +2166,7 @@
             if (success && ethData.vlanId)
             {
                 auto callback =
-                    [asyncResp](const boost::system::error_code ec) {
+                    [asyncResp](const boost::system::error_code& ec) {
                     if (ec)
                     {
                         messages::internalError(asyncResp->res);
@@ -2281,7 +2282,7 @@
             return;
         }
 
-        auto callback = [asyncResp](const boost::system::error_code ec) {
+        auto callback = [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 // TODO(ed) make more consistent error messages
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 143b0fc..643ce7f 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -214,7 +214,7 @@
     {
         std::shared_ptr<HealthPopulate> self = shared_from_this();
         crow::connections::systemBus->async_method_call(
-            [self](const boost::system::error_code ec,
+            [self](const boost::system::error_code& ec,
                    const dbus::utility::ManagedObjectType& resp) {
             if (ec)
             {
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 0fd603f..41d661a 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -43,7 +43,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.Hypervisor",
         "/xyz/openbmc_project/state/hypervisor0",
         "xyz.openbmc_project.State.Host", "CurrentHostState",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& hostState) {
         if (ec)
         {
@@ -322,7 +322,7 @@
     crow::connections::systemBus->async_method_call(
         [ethIfaceId{std::string{ethIfaceId}},
          callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code error,
+            const boost::system::error_code& error,
             const dbus::utility::ManagedObjectType& resp) {
         EthernetInterfaceData ethData{};
         boost::container::flat_set<IPv4AddressData> ipv4Data;
@@ -361,7 +361,7 @@
     BMCWEB_LOG_DEBUG << "Setting the Hypervisor IPaddress : " << ipv4Address
                      << " on Iface: " << ethIfaceId;
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error " << ec;
@@ -393,7 +393,7 @@
                      << " on Iface: " << ethIfaceId;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error " << ec;
@@ -425,7 +425,7 @@
         << "Setting the DefaultGateway to the last configured gateway";
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error " << ec;
@@ -526,7 +526,7 @@
 {
     const std::string dhcp = getDhcpEnabledEnumeration(ipv4DHCPEnabled, false);
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -555,7 +555,7 @@
         origin = "xyz.openbmc_project.Network.IP.AddressOrigin.DHCP";
     }
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error " << ec;
@@ -690,7 +690,7 @@
 
     asyncResp->res.jsonValue["HostName"] = hostName;
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -708,7 +708,7 @@
                             const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -742,7 +742,7 @@
             *crow::connections::systemBus, "xyz.openbmc_project.Settings",
             "/xyz/openbmc_project/network/hypervisor",
             "xyz.openbmc_project.Network.SystemConfiguration", "HostName",
-            [asyncResp](const boost::system::error_code ec,
+            [asyncResp](const boost::system::error_code& ec,
                         const std::string& /*hostName*/) {
             if (ec)
             {
@@ -1082,7 +1082,7 @@
         std::string command = "xyz.openbmc_project.State.Host.Transition.On";
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, resetType](const boost::system::error_code ec) {
+            [asyncResp, resetType](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 4c4c513..a5725f1 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -40,7 +40,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
         "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
         "xyz.openbmc_project.Led.Group", "Asserted",
-        [aResp](const boost::system::error_code ec, const bool blinking) {
+        [aResp](const boost::system::error_code& ec, const bool blinking) {
         // Some systems may not have enclosure_identify_blink object so
         // proceed to get enclosure_identify state.
         if (ec == boost::system::errc::invalid_argument)
@@ -63,7 +63,7 @@
             "xyz.openbmc_project.LED.GroupManager",
             "/xyz/openbmc_project/led/groups/enclosure_identify",
             "xyz.openbmc_project.Led.Group", "Asserted",
-            [aResp](const boost::system::error_code ec2, const bool ledOn) {
+            [aResp](const boost::system::error_code& ec2, const bool ledOn) {
             if (ec2 == boost::system::errc::invalid_argument)
             {
                 BMCWEB_LOG_DEBUG
@@ -121,7 +121,8 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [aResp, ledOn, ledBlinkng](const boost::system::error_code ec) mutable {
+        [aResp, ledOn,
+         ledBlinkng](const boost::system::error_code& ec) mutable {
         if (ec)
         {
             // Some systems may not have enclosure_identify_blink object so
@@ -133,7 +134,7 @@
             }
         }
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec2) {
+            [aResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -170,7 +171,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
         "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
         "xyz.openbmc_project.Led.Group", "Asserted",
-        [aResp](const boost::system::error_code ec, const bool blinking) {
+        [aResp](const boost::system::error_code& ec, const bool blinking) {
         // Some systems may not have enclosure_identify_blink object so
         // proceed to get enclosure_identify state.
         if (ec == boost::system::errc::invalid_argument)
@@ -193,7 +194,7 @@
             "xyz.openbmc_project.LED.GroupManager",
             "/xyz/openbmc_project/led/groups/enclosure_identify",
             "xyz.openbmc_project.Led.Group", "Asserted",
-            [aResp](const boost::system::error_code ec2, const bool ledOn) {
+            [aResp](const boost::system::error_code& ec2, const bool ledOn) {
             if (ec2 == boost::system::errc::invalid_argument)
             {
                 BMCWEB_LOG_DEBUG
@@ -227,14 +228,14 @@
     BMCWEB_LOG_DEBUG << "Set LocationIndicatorActive";
 
     crow::connections::systemBus->async_method_call(
-        [aResp, ledState](const boost::system::error_code ec) mutable {
+        [aResp, ledState](const boost::system::error_code& ec) mutable {
         if (ec)
         {
             // Some systems may not have enclosure_identify_blink object so
             // lets set enclosure_identify state also if
             // enclosure_identify_blink failed
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec2) {
+                [aResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index ee57557..24a0657 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -455,7 +455,7 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp, entriesPath,
-         dumpType](const boost::system::error_code ec,
+         dumpType](const boost::system::error_code& ec,
                    dbus::utility::ManagedObjectType& resp) {
         if (ec)
         {
@@ -561,7 +561,7 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp, entryID, dumpType,
-         entriesPath](const boost::system::error_code ec,
+         entriesPath](const boost::system::error_code& ec,
                       const dbus::utility::ManagedObjectType& resp) {
         if (ec)
         {
@@ -642,7 +642,7 @@
                             const std::string& dumpType)
 {
     auto respHandler =
-        [asyncResp, entryID](const boost::system::error_code ec) {
+        [asyncResp, entryID](const boost::system::error_code& ec) {
         BMCWEB_LOG_DEBUG << "Dump Entry doDelete callback: Done";
         if (ec)
         {
@@ -734,7 +734,7 @@
     crow::connections::systemBus->async_method_call(
         [asyncResp, payload, createdObjPath,
          dumpEntryPath{std::move(dumpEntryPath)},
-         dumpId](const boost::system::error_code ec,
+         dumpId](const boost::system::error_code& ec,
                  const std::string& introspectXml) {
         if (ec)
         {
@@ -782,7 +782,7 @@
 
         std::shared_ptr<task::TaskData> task = task::TaskData::createTask(
             [createdObjPath, dumpEntryPath, dumpId, isProgressIntfPresent](
-                boost::system::error_code err, sdbusplus::message_t& msg,
+                const boost::system::error_code& err, sdbusplus::message_t& msg,
                 const std::shared_ptr<task::TaskData>& taskData) {
             if (err)
             {
@@ -913,9 +913,10 @@
         createDumpParamVec;
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, payload(task::Payload(req)), dumpPath](
-            const boost::system::error_code ec, const sdbusplus::message_t& msg,
-            const sdbusplus::message::object_path& objPath) mutable {
+        [asyncResp, payload(task::Payload(req)),
+         dumpPath](const boost::system::error_code& ec,
+                   const sdbusplus::message_t& msg,
+                   const sdbusplus::message::object_path& objPath) mutable {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "CreateDump resp_handler got error " << ec;
@@ -1191,7 +1192,7 @@
 
         // Reload rsyslog so it knows to start new log files
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Failed to reload rsyslog: " << ec;
@@ -1515,7 +1516,7 @@
         // DBus implementation of EventLog/Entries
         // Make call to Logging Service to find all log entry objects
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec,
+            [asyncResp](const boost::system::error_code& ec,
                         const dbus::utility::ManagedObjectType& resp) {
             if (ec)
             {
@@ -1702,7 +1703,7 @@
         sdbusplus::asio::getAllProperties(
             *crow::connections::systemBus, "xyz.openbmc_project.Logging",
             "/xyz/openbmc_project/logging/entry/" + entryID, "",
-            [asyncResp, entryID](const boost::system::error_code ec,
+            [asyncResp, entryID](const boost::system::error_code& ec,
                                  const dbus::utility::DBusPropertiesMap& resp) {
             if (ec.value() == EBADR)
             {
@@ -1811,7 +1812,7 @@
         BMCWEB_LOG_DEBUG << "Set Resolved";
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, entryId](const boost::system::error_code ec) {
+            [asyncResp, entryId](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1852,7 +1853,7 @@
 
         // Process response from Logging service.
         auto respHandler =
-            [asyncResp, entryID](const boost::system::error_code ec) {
+            [asyncResp, entryID](const boost::system::error_code& ec) {
             BMCWEB_LOG_DEBUG << "EventLogEntry (DBus) doDelete callback: Done";
             if (ec)
             {
@@ -1914,7 +1915,7 @@
         dbus::utility::escapePathForDbus(entryID);
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, entryID](const boost::system::error_code ec,
+            [asyncResp, entryID](const boost::system::error_code& ec,
                                  const sdbusplus::message::unix_fd& unixfd) {
             if (ec.value() == EBADR)
             {
@@ -3053,7 +3054,7 @@
             return;
         }
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec,
+            [asyncResp](const boost::system::error_code& ec,
                         const std::string&) {
             if (ec)
             {
@@ -3072,7 +3073,7 @@
 {
     auto getStoredLogCallback =
         [asyncResp, logID,
-         &logEntryJson](const boost::system::error_code ec,
+         &logEntryJson](const boost::system::error_code& ec,
                         const dbus::utility::DBusPropertiesMap& params) {
         if (ec)
         {
@@ -3261,7 +3262,7 @@
 
         auto getStoredLogCallback =
             [asyncResp, logID, fileName, url(boost::urls::url(req.urlView))](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const std::vector<
                     std::pair<std::string, dbus::utility::DbusVariantType>>&
                     resp) {
@@ -3416,7 +3417,7 @@
 
         auto collectCrashdumpCallback =
             [asyncResp, payload(task::Payload(req)),
-             taskMatchStr](const boost::system::error_code ec,
+             taskMatchStr](const boost::system::error_code& ec,
                            const std::string&) mutable {
             if (ec)
             {
@@ -3437,7 +3438,7 @@
                 return;
             }
             std::shared_ptr<task::TaskData> task = task::TaskData::createTask(
-                [](boost::system::error_code err, sdbusplus::message_t&,
+                [](const boost::system::error_code& err, sdbusplus::message_t&,
                    const std::shared_ptr<task::TaskData>& taskData) {
                 if (!err)
                 {
@@ -3492,7 +3493,7 @@
         BMCWEB_LOG_DEBUG << "Do delete all entries.";
 
         // Process response from Logging service.
-        auto respHandler = [asyncResp](const boost::system::error_code ec) {
+        auto respHandler = [asyncResp](const boost::system::error_code& ec) {
             BMCWEB_LOG_DEBUG << "doClearLog resp_handler callback: Done";
             if (ec)
             {
@@ -3585,7 +3586,7 @@
 
         // Make call to post-code service to request clear all
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 // TODO Handle for specific error code
@@ -3799,7 +3800,7 @@
 
     crow::connections::systemBus->async_method_call(
         [aResp, entryId, bootIndex,
-         codeIndex](const boost::system::error_code ec,
+         codeIndex](const boost::system::error_code& ec,
                     const boost::container::flat_map<
                         uint64_t, std::tuple<uint64_t, std::vector<uint8_t>>>&
                         postcode) {
@@ -3836,7 +3837,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [aResp, bootIndex, bootCount, entryCount, skip,
-         top](const boost::system::error_code ec,
+         top](const boost::system::error_code& ec,
               const boost::container::flat_map<
                   uint64_t, std::tuple<uint64_t, std::vector<uint8_t>>>&
                   postcode) {
@@ -3895,7 +3896,7 @@
         "xyz.openbmc_project.State.Boot.PostCode0",
         "/xyz/openbmc_project/State/Boot/PostCode0",
         "xyz.openbmc_project.State.Boot.PostCode", "CurrentBootCycleCount",
-        [aResp, entryCount, skip, top](const boost::system::error_code ec,
+        [aResp, entryCount, skip, top](const boost::system::error_code& ec,
                                        const uint16_t bootCount) {
         if (ec)
         {
@@ -3987,7 +3988,7 @@
 
         crow::connections::systemBus->async_method_call(
             [asyncResp, postCodeID, currentValue](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const std::vector<std::tuple<uint64_t, std::vector<uint8_t>>>&
                     postcodes) {
             if (ec.value() == EBADR)
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 9da1be0..01ec4e5 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -61,7 +61,7 @@
     dbus::utility::DbusVariantType dbusPropertyValue(propertyValue);
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         // Use "Set" method to set the property value.
         if (ec)
         {
@@ -90,7 +90,7 @@
     dbus::utility::DbusVariantType dbusPropertyValue(propertyValue);
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         // Use "Set" method to set the property value.
         if (ec)
         {
@@ -211,7 +211,7 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_DEBUG << "Failed to ResetToDefaults: " << ec;
@@ -291,7 +291,7 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp, currentProfile, supportedProfiles](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::ManagedObjectType& managedObj) {
         if (ec)
         {
@@ -809,7 +809,7 @@
         BMCWEB_LOG_DEBUG << "del " << path << " " << iface << "\n";
         // delete interface
         crow::connections::systemBus->async_method_call(
-            [response, path](const boost::system::error_code ec) {
+            [response, path](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Error patching " << path << ": " << ec;
@@ -1236,7 +1236,7 @@
             sdbusplus::asio::getAllProperties(
                 *crow::connections::systemBus, owner, path, thermalModeIface,
                 [path, owner,
-                 self](const boost::system::error_code ec2,
+                 self](const boost::system::error_code& ec2,
                        const dbus::utility::DBusPropertiesMap& resp) {
                 if (ec2)
                 {
@@ -1396,7 +1396,7 @@
         // todo(james): might make sense to do a mapper call here if this
         // interface gets more traction
         crow::connections::systemBus->async_method_call(
-            [self](const boost::system::error_code ec,
+            [self](const boost::system::error_code& ec,
                    const dbus::utility::ManagedObjectType& mObj) {
             if (ec)
             {
@@ -1449,7 +1449,7 @@
             const std::string& owner = subtree[0].second[0].first;
             sdbusplus::asio::getAllProperties(
                 *crow::connections::systemBus, owner, path, thermalModeIface,
-                [self, path, owner](const boost::system::error_code ec2,
+                [self, path, owner](const boost::system::error_code& ec2,
                                     const dbus::utility::DBusPropertiesMap& r) {
                 if (ec2)
                 {
@@ -1503,7 +1503,7 @@
             }
             currentProfile = *profile;
             crow::connections::systemBus->async_method_call(
-                [response](const boost::system::error_code ec) {
+                [response](const boost::system::error_code& ec) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "Error patching profile" << ec;
@@ -1637,7 +1637,7 @@
                         crow::connections::systemBus->async_method_call(
                             [response,
                              propertyName{std::string(property.first)}](
-                                const boost::system::error_code ec) {
+                                const boost::system::error_code& ec) {
                             if (ec)
                             {
                                 BMCWEB_LOG_ERROR << "Error patching "
@@ -1682,7 +1682,7 @@
                     }
 
                     crow::connections::systemBus->async_method_call(
-                        [response](const boost::system::error_code ec) {
+                        [response](const boost::system::error_code& ec) {
                         if (ec)
                         {
                             BMCWEB_LOG_ERROR << "Error Adding Pid Object "
@@ -1740,7 +1740,7 @@
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& property) {
         if (ec)
         {
@@ -1764,7 +1764,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.BMC",
         "/xyz/openbmc_project/state/bmc0", "xyz.openbmc_project.State.BMC",
         "LastRebootTime",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const uint64_t lastResetTime) {
         if (ec)
         {
@@ -1816,7 +1816,7 @@
     // Make sure the image is valid before setting priority
     crow::connections::systemBus->async_method_call(
         [aResp, firmwareId,
-         runningFirmwareTarget](const boost::system::error_code ec,
+         runningFirmwareTarget](const boost::system::error_code& ec,
                                 dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
@@ -1872,7 +1872,7 @@
         // An addition could be a Redfish Setting like
         // ActiveSoftwareImageApplyTime and support OnReset
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec2) {
+            [aResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-Bus response error setting.";
@@ -1907,7 +1907,7 @@
     }
     crow::connections::systemBus->async_method_call(
         [aResp{std::move(aResp)},
-         datetime{std::move(datetime)}](const boost::system::error_code ec) {
+         datetime{std::move(datetime)}](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "Failed to set elapsed time. "
@@ -2074,7 +2074,7 @@
                 *crow::connections::systemBus, "org.freedesktop.systemd1",
                 "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager",
                 "Progress",
-                [asyncResp](const boost::system::error_code ec,
+                [asyncResp](const boost::system::error_code& ec,
                             const double& val) {
                 if (ec)
                 {
@@ -2135,7 +2135,7 @@
                     sdbusplus::asio::getAllProperties(
                         *crow::connections::systemBus, connectionName, path,
                         "xyz.openbmc_project.Inventory.Decorator.Asset",
-                        [asyncResp](const boost::system::error_code ec2,
+                        [asyncResp](const boost::system::error_code& ec2,
                                     const dbus::utility::DBusPropertiesMap&
                                         propertiesList) {
                         if (ec2)
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 6e77816..4478472 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -614,7 +614,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath, "",
         [dimmId, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -687,7 +687,7 @@
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition",
         [aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index eb69ff0..d12ba10 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -117,7 +117,7 @@
             sdbusplus::asio::getProperty<telemetry::TimestampReadings>(
                 *crow::connections::systemBus, telemetry::service, reportPath,
                 telemetry::reportInterface, "Readings",
-                [asyncResp, id](const boost::system::error_code ec2,
+                [asyncResp, id](const boost::system::error_code& ec2,
                                 const telemetry::TimestampReadings& ret) {
                 if (ec2)
                 {
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index ab03ea0..2e97fa0 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -288,7 +288,7 @@
         const std::shared_ptr<bmcweb::AsyncResp> aResp = asyncResp;
         crow::connections::systemBus->async_method_call(
             [aResp, name = args.name, uriToDbus = std::move(uriToDbus)](
-                const boost::system::error_code ec, const std::string&) {
+                const boost::system::error_code& ec, const std::string&) {
             if (ec == boost::system::errc::file_exists)
             {
                 messages::resourceAlreadyExists(
@@ -436,7 +436,7 @@
             *crow::connections::systemBus, telemetry::service,
             telemetry::getDbusReportPath(id), telemetry::reportInterface,
             [asyncResp,
-             id](const boost::system::error_code ec,
+             id](const boost::system::error_code& ec,
                  const std::vector<std::pair<
                      std::string, dbus::utility::DbusVariantType>>& ret) {
             if (ec.value() == EBADR ||
@@ -473,7 +473,7 @@
         const std::string reportPath = telemetry::getDbusReportPath(id);
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, id](const boost::system::error_code ec) {
+            [asyncResp, id](const boost::system::error_code& ec) {
             /*
              * boost::system::errc and std::errc are missing value
              * for EBADR error that is defined in Linux.
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index d3910b3..aab780b 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -94,7 +94,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code errorCode,
+            const boost::system::error_code& errorCode,
             const dbus::utility::ManagedObjectType& dbusData) {
         std::vector<std::string> ntpServers;
         std::vector<std::string> domainNames;
@@ -185,7 +185,7 @@
         const std::string& serviceName = protocol.second;
         getPortStatusAndPath(
             serviceName,
-            [asyncResp, protocolName](const boost::system::error_code ec,
+            [asyncResp, protocolName](const boost::system::error_code& ec,
                                       const std::string& socketPath,
                                       bool isProtocolEnabled) {
             // If the service is not installed, that is not an error
@@ -205,7 +205,7 @@
             asyncResp->res.jsonValue[protocolName]["ProtocolEnabled"] =
                 isProtocolEnabled;
             getPortNumber(socketPath, [asyncResp, protocolName](
-                                          const boost::system::error_code ec2,
+                                          const boost::system::error_code& ec2,
                                           int portNumber) {
                 if (ec2)
                 {
@@ -233,7 +233,7 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code errorCode) {
+        [asyncResp](const boost::system::error_code& errorCode) {
         if (errorCode)
         {
             messages::internalError(asyncResp->res);
@@ -350,7 +350,7 @@
                     }
 
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec2) {
+                        [asyncResp](const boost::system::error_code& ec2) {
                         if (ec2)
                         {
                             messages::internalError(asyncResp->res);
@@ -389,7 +389,7 @@
             if (boost::algorithm::starts_with(entry.first, netBasePath))
             {
                 crow::connections::systemBus->async_method_call(
-                    [asyncResp](const boost::system::error_code ec2) {
+                    [asyncResp](const boost::system::error_code& ec2) {
                     if (ec2)
                     {
                         messages::internalError(asyncResp->res);
@@ -402,7 +402,7 @@
                     dbus::utility::DbusVariantType{protocolEnabled});
 
                 crow::connections::systemBus->async_method_call(
-                    [asyncResp](const boost::system::error_code ec2) {
+                    [asyncResp](const boost::system::error_code& ec2) {
                     if (ec2)
                     {
                         messages::internalError(asyncResp->res);
@@ -437,7 +437,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/time/sync_method",
         "xyz.openbmc_project.Time.Synchronization", "TimeSyncMethod",
-        [asyncResp](const boost::system::error_code errorCode,
+        [asyncResp](const boost::system::error_code& errorCode,
                     const std::string& timeSyncMethod) {
         if (errorCode)
         {
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 5332a39..c3b7546 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -169,7 +169,7 @@
 
         auto getPCIeDeviceCallback =
             [asyncResp, device](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
             if (ec)
             {
@@ -288,7 +288,7 @@
 
         auto getPCIeDeviceCallback =
             [asyncResp, device](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
             if (ec)
             {
@@ -364,7 +364,7 @@
         }
         auto getPCIeDeviceCallback =
             [asyncResp, device, function](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
             if (ec)
             {
diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp
index 70efa13..42c8bb1 100644
--- a/redfish-core/lib/pcie_slots.hpp
+++ b/redfish-core/lib/pcie_slots.hpp
@@ -71,7 +71,7 @@
 
 inline void
     onPcieSlotGetAllDone(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                         const boost::system::error_code ec,
+                         const boost::system::error_code& ec,
                          const dbus::utility::DBusPropertiesMap& propertiesList)
 {
     if (ec)
@@ -150,7 +150,7 @@
 inline void onMapperAssociationDone(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& chassisID, const std::string& pcieSlotPath,
-    const std::string& connectionName, const boost::system::error_code ec,
+    const std::string& connectionName, const boost::system::error_code& ec,
     const std::variant<std::vector<std::string>>& endpoints)
 {
     if (ec)
@@ -193,7 +193,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, connectionName, pcieSlotPath,
         "xyz.openbmc_project.Inventory.Item.PCIeSlot",
-        [asyncResp](const boost::system::error_code ec2,
+        [asyncResp](const boost::system::error_code& ec2,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
         onPcieSlotGetAllDone(asyncResp, ec2, propertiesList);
         });
@@ -202,7 +202,7 @@
 inline void
     onMapperSubtreeDone(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                         const std::string& chassisID,
-                        const boost::system::error_code ec,
+                        const boost::system::error_code& ec,
                         const dbus::utility::MapperGetSubTreeResponse& subtree)
 {
     if (ec)
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index 116ea25..7dbf660 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -79,7 +79,7 @@
             *crow::connections::systemBus, "xyz.openbmc_project.Settings",
             "/xyz/openbmc_project/control/host0/power_cap",
             "xyz.openbmc_project.Control.Power.Cap", "PowerCapEnable",
-            [value, sensorsAsyncResp](const boost::system::error_code ec,
+            [value, sensorsAsyncResp](const boost::system::error_code& ec,
                                       bool powerCapEnable) {
             if (ec)
             {
@@ -98,7 +98,7 @@
             }
 
             crow::connections::systemBus->async_method_call(
-                [sensorsAsyncResp](const boost::system::error_code ec2) {
+                [sensorsAsyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "Power Limit Set: Dbus error: " << ec2;
@@ -196,7 +196,7 @@
 
             auto valueHandler =
                 [sensorAsyncResp](
-                    const boost::system::error_code ec,
+                    const boost::system::error_code& ec,
                     const dbus::utility::DBusPropertiesMap& properties) {
                 if (ec)
                 {
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 8b1bfa9..51290b8 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -60,7 +60,7 @@
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Common.UUID", "UUID",
-        [objPath, aResp{std::move(aResp)}](const boost::system::error_code ec,
+        [objPath, aResp{std::move(aResp)}](const boost::system::error_code& ec,
                                            const std::string& property) {
         if (ec)
         {
@@ -224,7 +224,7 @@
 
     crow::connections::systemBus->async_method_call(
         [cpuId, service, objPath, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::ManagedObjectType& dbusData) {
         if (ec)
         {
@@ -299,7 +299,7 @@
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Decorator.Asset",
         [objPath, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -373,7 +373,7 @@
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Decorator.Revision",
         [objPath, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -409,7 +409,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath, "",
         [acclrtrId, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -523,7 +523,7 @@
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Control.Processor.CurrentOperatingConfig",
         [aResp, cpuId,
-         service](const boost::system::error_code ec,
+         service](const boost::system::error_code& ec,
                   const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -584,7 +584,7 @@
                 "OperatingConfig",
                 "BaseSpeedPrioritySettings",
                 [aResp](
-                    const boost::system::error_code ec2,
+                    const boost::system::error_code& ec2,
                     const BaseSpeedPrioritySettingsProperty& baseSpeedList) {
                 if (ec2)
                 {
@@ -621,7 +621,7 @@
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
-        [objPath, aResp{std::move(aResp)}](const boost::system::error_code ec,
+        [objPath, aResp{std::move(aResp)}](const boost::system::error_code& ec,
                                            const std::string& property) {
         if (ec)
         {
@@ -652,7 +652,7 @@
         *crow::connections::systemBus, service, objectPath,
         "xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier",
         "UniqueIdentifier",
-        [aResp](boost::system::error_code ec, const std::string& id) {
+        [aResp](const boost::system::error_code& ec, const std::string& id) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "Failed to read cpu unique id: " << ec;
@@ -812,7 +812,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Item.Cpu.OperatingConfig",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -912,7 +912,7 @@
 inline void
     handleAppliedConfigResponse(const std::shared_ptr<bmcweb::AsyncResp>& resp,
                                 const std::string& setPropVal,
-                                boost::system::error_code ec,
+                                const boost::system::error_code& ec,
                                 const sdbusplus::message_t& msg)
 {
     if (!ec)
@@ -1018,7 +1018,7 @@
 
     // Set the property, with handler to check error responses
     crow::connections::systemBus->async_method_call(
-        [resp, appliedConfigUri](const boost::system::error_code ec,
+        [resp, appliedConfigUri](const boost::system::error_code& ec,
                                  const sdbusplus::message_t& msg) {
         handleAppliedConfigResponse(resp, appliedConfigUri, ec, msg);
         },
diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp
index d7a7f8c..9d358c0 100644
--- a/redfish-core/lib/redfish_util.hpp
+++ b/redfish-core/lib/redfish_util.hpp
@@ -102,7 +102,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [serviceName, callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const std::vector<UnitStruct>& r) {
         if (ec)
         {
@@ -180,7 +180,7 @@
         *crow::connections::systemBus, "org.freedesktop.systemd1", socketPath,
         "org.freedesktop.systemd1.Socket", "Listen",
         [callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const std::vector<std::tuple<std::string, std::string>>& resp) {
         if (ec)
         {
diff --git a/redfish-core/lib/roles.hpp b/redfish-core/lib/roles.hpp
index fe9110c..c982347 100644
--- a/redfish-core/lib/roles.hpp
+++ b/redfish-core/lib/roles.hpp
@@ -122,7 +122,7 @@
             *crow::connections::systemBus, "xyz.openbmc_project.User.Manager",
             "/xyz/openbmc_project/user", "xyz.openbmc_project.User.Manager",
             "AllPrivileges",
-            [asyncResp](const boost::system::error_code ec,
+            [asyncResp](const boost::system::error_code& ec,
                         const std::vector<std::string>& privList) {
             if (ec)
             {
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 3ff4842..1af3032 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -1003,7 +1003,7 @@
                 "xyz.openbmc_project.ObjectMapper", path + "/chassis",
                 "xyz.openbmc_project.Association", "endpoints",
                 [path, owner,
-                 sensorsAsyncResp](const boost::system::error_code e,
+                 sensorsAsyncResp](const boost::system::error_code& e,
                                    const std::vector<std::string>& endpoints) {
                 if (e)
                 {
@@ -1445,7 +1445,7 @@
         auto respHandler = [sensorsAsyncResp, inventoryItems, invConnections,
                             callback{std::forward<Callback>(callback)},
                             invConnectionsIndex](
-                               const boost::system::error_code ec,
+                               const boost::system::error_code& ec,
                                const dbus::utility::ManagedObjectType& resp) {
             BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler enter";
             if (ec)
@@ -1601,7 +1601,7 @@
     // Response handler for GetManagedObjects
     auto respHandler =
         [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
-         sensorNames](const boost::system::error_code ec,
+         sensorNames](const boost::system::error_code& ec,
                       const dbus::utility::ManagedObjectType& resp) {
         BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler enter";
         if (ec)
@@ -1775,7 +1775,7 @@
         auto respHandler =
             [sensorsAsyncResp, inventoryItems, ledConnections, ledPath,
              callback{std::forward<Callback>(callback)}, ledConnectionsIndex](
-                const boost::system::error_code ec, const std::string& state) {
+                const boost::system::error_code& ec, const std::string& state) {
             BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler enter";
             if (ec)
             {
@@ -1959,7 +1959,7 @@
     auto respHandler =
         [sensorsAsyncResp, inventoryItems,
          callback{std::forward<Callback>(callback)}](
-            const boost::system::error_code ec, const uint32_t value) {
+            const boost::system::error_code& ec, const uint32_t value) {
         BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler enter";
         if (ec)
         {
@@ -2264,7 +2264,7 @@
         // Response handler to process managed objects
         auto getManagedObjectsCb =
             [sensorsAsyncResp, sensorNames,
-             inventoryItems](const boost::system::error_code ec,
+             inventoryItems](const boost::system::error_code& ec,
                              const dbus::utility::ManagedObjectType& resp) {
             BMCWEB_LOG_DEBUG << "getManagedObjectsCb enter";
             if (ec)
@@ -2696,7 +2696,7 @@
                     return;
                 }
                 crow::connections::systemBus->async_method_call(
-                    [sensorAsyncResp](const boost::system::error_code ec) {
+                    [sensorAsyncResp](const boost::system::error_code& ec) {
                     if (ec)
                     {
                         if (ec.value() ==
@@ -2865,7 +2865,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, connectionName, sensorPath, "",
         [asyncResp,
-         sensorPath](const boost::system::error_code ec,
+         sensorPath](const boost::system::error_code& ec,
                      const ::dbus::utility::DBusPropertiesMap& valuesDict) {
         if (ec)
         {
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 88ced62..5f3ccd3 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -169,7 +169,7 @@
             sdbusplus::asio::getProperty<bool>(
                 *crow::connections::systemBus, connectionName, path,
                 "xyz.openbmc_project.Inventory.Item", "Present",
-                [asyncResp, index](const boost::system::error_code ec2,
+                [asyncResp, index](const boost::system::error_code& ec2,
                                    bool isPresent) {
                 // this interface isn't necessary, only check it
                 // if we get a good return
@@ -188,7 +188,7 @@
                 *crow::connections::systemBus, connectionName, path,
                 "xyz.openbmc_project.Inventory.Decorator.Asset",
                 [asyncResp, index](
-                    const boost::system::error_code ec2,
+                    const boost::system::error_code& ec2,
                     const std::vector<
                         std::pair<std::string, dbus::utility::DbusVariantType>>&
                         propertiesList) {
@@ -291,7 +291,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Inventory.Decorator.Asset",
-        [asyncResp](const boost::system::error_code ec,
+        [asyncResp](const boost::system::error_code& ec,
                     const std::vector<
                         std::pair<std::string, dbus::utility::DbusVariantType>>&
                         propertiesList) {
@@ -346,7 +346,7 @@
     sdbusplus::asio::getProperty<bool>(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Inventory.Item", "Present",
-        [asyncResp, path](const boost::system::error_code ec,
+        [asyncResp, path](const boost::system::error_code& ec,
                           const bool isPresent) {
         // this interface isn't necessary, only check it if
         // we get a good return
@@ -369,7 +369,7 @@
     sdbusplus::asio::getProperty<bool>(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.State.Drive", "Rebuilding",
-        [asyncResp](const boost::system::error_code ec, const bool updating) {
+        [asyncResp](const boost::system::error_code& ec, const bool updating) {
         // this interface isn't necessary, only check it
         // if we get a good return
         if (ec)
@@ -432,7 +432,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Inventory.Item.Drive",
-        [asyncResp](const boost::system::error_code ec,
+        [asyncResp](const boost::system::error_code& ec,
                     const std::vector<
                         std::pair<std::string, dbus::utility::DbusVariantType>>&
                         propertiesList) {
@@ -706,7 +706,7 @@
                 *crow::connections::systemBus,
                 "xyz.openbmc_project.ObjectMapper", path + "/drive",
                 "xyz.openbmc_project.Association", "endpoints",
-                [asyncResp, chassisId](const boost::system::error_code ec3,
+                [asyncResp, chassisId](const boost::system::error_code& ec3,
                                        const std::vector<std::string>& resp) {
                 if (ec3)
                 {
@@ -753,7 +753,7 @@
 inline void buildDrive(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                        const std::string& chassisId,
                        const std::string& driveName,
-                       const boost::system::error_code ec,
+                       const boost::system::error_code& ec,
                        const dbus::utility::MapperGetSubTreeResponse& subtree)
 {
 
@@ -872,7 +872,7 @@
                 "xyz.openbmc_project.ObjectMapper", path + "/drive",
                 "xyz.openbmc_project.Association", "endpoints",
                 [asyncResp, chassisId,
-                 driveName](const boost::system::error_code ec3,
+                 driveName](const boost::system::error_code& ec3,
                             const std::vector<std::string>& resp) {
                 if (ec3)
                 {
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 06729fd..59abd4f 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -181,7 +181,7 @@
                                 const std::string& path)
 {
 
-    auto getCpuPresenceState = [aResp](const boost::system::error_code ec3,
+    auto getCpuPresenceState = [aResp](const boost::system::error_code& ec3,
                                        const bool cpuPresenceCheck) {
         if (ec3)
         {
@@ -191,7 +191,7 @@
         modifyCpuPresenceState(aResp, cpuPresenceCheck);
     };
 
-    auto getCpuFunctionalState = [aResp](const boost::system::error_code ec3,
+    auto getCpuFunctionalState = [aResp](const boost::system::error_code& ec3,
                                          const bool cpuFunctionalCheck) {
         if (ec3)
         {
@@ -217,7 +217,7 @@
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.Inventory.Item.Cpu",
         [aResp, service,
-         path](const boost::system::error_code ec2,
+         path](const boost::system::error_code& ec2,
                const dbus::utility::DBusPropertiesMap& properties) {
         if (ec2)
         {
@@ -300,7 +300,7 @@
                             *crow::connections::systemBus, connection.first,
                             path, "xyz.openbmc_project.Inventory.Item.Dimm",
                             [aResp, service{connection.first},
-                             path](const boost::system::error_code ec2,
+                             path](const boost::system::error_code& ec2,
                                    const dbus::utility::DBusPropertiesMap&
                                        properties) {
                             if (ec2)
@@ -321,8 +321,9 @@
                                     "xyz.openbmc_project.State."
                                     "Decorator.OperationalStatus",
                                     "Functional",
-                                    [aResp](const boost::system::error_code ec3,
-                                            bool dimmState) {
+                                    [aResp](
+                                        const boost::system::error_code& ec3,
+                                        bool dimmState) {
                                     if (ec3)
                                     {
                                         BMCWEB_LOG_ERROR
@@ -396,7 +397,7 @@
                         sdbusplus::asio::getAllProperties(
                             *crow::connections::systemBus, connection.first,
                             path, "xyz.openbmc_project.Common.UUID",
-                            [aResp](const boost::system::error_code ec3,
+                            [aResp](const boost::system::error_code& ec3,
                                     const dbus::utility::DBusPropertiesMap&
                                         properties) {
                             if (ec3)
@@ -444,7 +445,7 @@
                             *crow::connections::systemBus, connection.first,
                             path,
                             "xyz.openbmc_project.Inventory.Decorator.Asset",
-                            [aResp](const boost::system::error_code ec2,
+                            [aResp](const boost::system::error_code& ec2,
                                     const dbus::utility::DBusPropertiesMap&
                                         propertiesList) {
                             if (ec2)
@@ -516,7 +517,7 @@
                             "xyz.openbmc_project.Inventory.Decorator."
                             "AssetTag",
                             "AssetTag",
-                            [aResp](const boost::system::error_code ec2,
+                            [aResp](const boost::system::error_code& ec2,
                                     const std::string& value) {
                             if (ec2)
                             {
@@ -549,7 +550,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
         "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Host",
         "CurrentHostState",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& hostState) {
         if (ec)
         {
@@ -838,7 +839,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
         "/xyz/openbmc_project/state/host0",
         "xyz.openbmc_project.State.Boot.Progress", "BootProgress",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& bootProgressStr) {
         if (ec)
         {
@@ -868,7 +869,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
         "/xyz/openbmc_project/state/host0",
         "xyz.openbmc_project.State.Boot.Progress", "BootProgressLastUpdate",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const uint64_t lastStateTime) {
         if (ec)
         {
@@ -902,7 +903,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/boot",
         "xyz.openbmc_project.Control.Boot.Type", "BootType",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& bootType) {
         if (ec)
         {
@@ -941,7 +942,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/boot",
         "xyz.openbmc_project.Control.Boot.Mode", "BootMode",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& bootModeStr) {
         if (ec)
         {
@@ -985,7 +986,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/boot",
         "xyz.openbmc_project.Control.Boot.Source", "BootSource",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const std::string& bootSourceStr) {
         if (ec)
         {
@@ -1038,7 +1039,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/boot/one_time",
         "xyz.openbmc_project.Object.Enable", "Enabled",
-        [aResp](const boost::system::error_code ec, bool oneTimeSetting) {
+        [aResp](const boost::system::error_code& ec, bool oneTimeSetting) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1073,7 +1074,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/boot",
         "xyz.openbmc_project.Object.Enable", "Enabled",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const bool bootOverrideEnable) {
         if (ec)
         {
@@ -1126,7 +1127,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.State.Chassis",
         "/xyz/openbmc_project/state/chassis0",
         "xyz.openbmc_project.State.Chassis", "LastStateChangeTime",
-        [aResp](const boost::system::error_code ec, uint64_t lastResetTime) {
+        [aResp](const boost::system::error_code& ec, uint64_t lastResetTime) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
@@ -1158,7 +1159,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/auto_reboot",
         "xyz.openbmc_project.Control.Boot.RebootPolicy", "AutoReboot",
-        [aResp](const boost::system::error_code ec, bool autoRebootEnabled) {
+        [aResp](const boost::system::error_code& ec, bool autoRebootEnabled) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
@@ -1177,7 +1178,7 @@
                 "/xyz/openbmc_project/state/host0",
                 "xyz.openbmc_project.Control.Boot.RebootAttempts",
                 "AttemptsLeft",
-                [aResp](const boost::system::error_code ec2,
+                [aResp](const boost::system::error_code& ec2,
                         const uint32_t autoRebootAttemptsLeft) {
                 if (ec2)
                 {
@@ -1227,7 +1228,8 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/control/host0/power_restore_policy",
         "xyz.openbmc_project.Control.Power.RestorePolicy", "PowerRestorePolicy",
-        [aResp](const boost::system::error_code ec, const std::string& policy) {
+        [aResp](const boost::system::error_code& ec,
+                const std::string& policy) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1316,7 +1318,7 @@
         sdbusplus::asio::getProperty<bool>(
             *crow::connections::systemBus, serv, path,
             "xyz.openbmc_project.Control.TPM.Policy", "TPMEnable",
-            [aResp](const boost::system::error_code ec2, bool tpmRequired) {
+            [aResp](const boost::system::error_code& ec2, bool tpmRequired) {
             if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get"
@@ -1405,7 +1407,7 @@
 
         // Valid TPM Enable object found, now setting the value
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec2) {
+            [aResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 BMCWEB_LOG_DEBUG
@@ -1464,7 +1466,7 @@
     BMCWEB_LOG_DEBUG << "DBUS boot type: " << bootTypeStr;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1533,7 +1535,7 @@
     BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec2) {
+        [aResp](const boost::system::error_code& ec2) {
         if (ec2)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -1559,7 +1561,7 @@
                      << bootOverridePersistent;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1613,7 +1615,7 @@
     BMCWEB_LOG_DEBUG << "DBUS boot mode: " << bootModeStr;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1629,7 +1631,7 @@
         dbus::utility::DbusVariantType(bootSourceStr));
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1724,7 +1726,7 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec2) {
+            [aResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-Bus response error on AssetTag Set "
@@ -1773,7 +1775,7 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(aResp->res);
@@ -1822,7 +1824,7 @@
     powerRestorPolicy = policyMapsIt->second;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
+        [aResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(aResp->res);
@@ -1850,7 +1852,7 @@
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, "xyz.openbmc_project.PFR.Manager",
         "/xyz/openbmc_project/pfr", "xyz.openbmc_project.PFR.Attributes",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& propertiesList) {
         nlohmann::json& oemPFR =
             aResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"];
@@ -2004,7 +2006,7 @@
         sdbusplus::asio::getProperty<std::string>(
             *crow::connections::systemBus, service, path,
             "xyz.openbmc_project.Control.Power.Mode", "PowerMode",
-            [aResp](const boost::system::error_code ec2,
+            [aResp](const boost::system::error_code& ec2,
                     const std::string& pmode) {
             if (ec2)
             {
@@ -2130,7 +2132,7 @@
 
         // Set the Power Mode property
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec2) {
+            [aResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 messages::internalError(aResp->res);
@@ -2219,7 +2221,7 @@
         *crow::connections::systemBus, "xyz.openbmc_project.Watchdog",
         "/xyz/openbmc_project/watchdog/host0",
         "xyz.openbmc_project.State.Watchdog",
-        [aResp](const boost::system::error_code ec,
+        [aResp](const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
@@ -2297,7 +2299,7 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
+            [aResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -2315,7 +2317,7 @@
     if (wdtEnable)
     {
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
+            [aResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -2458,7 +2460,7 @@
         sdbusplus::asio::getAllProperties(
             *crow::connections::systemBus, service, path,
             "xyz.openbmc_project.Control.Power.IdlePowerSaver",
-            [aResp](const boost::system::error_code ec2,
+            [aResp](const boost::system::error_code& ec2,
                     const dbus::utility::DBusPropertiesMap& properties) {
             if (ec2)
             {
@@ -2557,7 +2559,7 @@
         if (ipsEnable)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec2) {
+                [aResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -2572,7 +2574,7 @@
         if (ipsEnterUtil)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec2) {
+                [aResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -2590,7 +2592,7 @@
             // Convert from seconds into milliseconds for DBus
             const uint64_t timeMilliseconds = *ipsEnterTime * 1000;
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec2) {
+                [aResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -2606,7 +2608,7 @@
         if (ipsExitUtil)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec2) {
+                [aResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -2624,7 +2626,7 @@
             // Convert from seconds into milliseconds for DBus
             const uint64_t timeMilliseconds = *ipsExitTime * 1000;
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec2) {
+                [aResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
                     BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
@@ -2688,7 +2690,7 @@
             *crow::connections::systemBus, "xyz.openbmc_project.Settings",
             "/xyz/openbmc_project/network/hypervisor",
             "xyz.openbmc_project.Network.SystemConfiguration", "HostName",
-            [asyncResp](const boost::system::error_code ec2,
+            [asyncResp](const boost::system::error_code& ec2,
                         const std::string& /*hostName*/) {
             nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
             ifaceArray = nlohmann::json::array();
@@ -2722,7 +2724,7 @@
     constexpr char const* method = "NMI";
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << " Bad D-Bus request error: " << ec;
@@ -2811,7 +2813,7 @@
         if (hostCommand)
         {
             crow::connections::systemBus->async_method_call(
-                [asyncResp, resetType](const boost::system::error_code ec) {
+                [asyncResp, resetType](const boost::system::error_code& ec) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -2837,7 +2839,7 @@
         else
         {
             crow::connections::systemBus->async_method_call(
-                [asyncResp, resetType](const boost::system::error_code ec) {
+                [asyncResp, resetType](const boost::system::error_code& ec) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 02d7f38..f9df850 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -39,7 +39,7 @@
         *crow::connections::systemBus, telemetry::service,
         "/xyz/openbmc_project/Telemetry/Reports",
         "xyz.openbmc_project.Telemetry.ReportManager",
-        [asyncResp](const boost::system::error_code ec,
+        [asyncResp](const boost::system::error_code& ec,
                     const dbus::utility::DBusPropertiesMap& ret) {
         if (ec == boost::system::errc::host_unreachable)
         {
diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp
index 33630cd..cb27075 100644
--- a/redfish-core/lib/trigger.hpp
+++ b/redfish-core/lib/trigger.hpp
@@ -333,7 +333,7 @@
             *crow::connections::systemBus, telemetry::service,
             telemetry::getDbusTriggerPath(id), telemetry::triggerInterface,
             [asyncResp,
-             id](const boost::system::error_code ec,
+             id](const boost::system::error_code& ec,
                  const std::vector<std::pair<
                      std::string, telemetry::TriggerGetParamsVariant>>& ret) {
             if (ec.value() == EBADR ||
@@ -369,7 +369,7 @@
         const std::string triggerPath = telemetry::getDbusTriggerPath(id);
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, id](const boost::system::error_code ec) {
+            [asyncResp, id](const boost::system::error_code& ec) {
             if (ec.value() == EBADR)
             {
                 messages::resourceNotFound(asyncResp->res, "Triggers", id);
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index c7b1593..d7dfbc4 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -60,7 +60,7 @@
 {
     BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
     crow::connections::systemBus->async_method_call(
-        [](const boost::system::error_code errorCode) {
+        [](const boost::system::error_code& errorCode) {
         if (errorCode)
         {
             BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
@@ -135,7 +135,7 @@
                 {
                     std::shared_ptr<task::TaskData> task =
                         task::TaskData::createTask(
-                            [](boost::system::error_code ec,
+                            [](const boost::system::error_code& ec,
                                sdbusplus::message_t& msg,
                                const std::shared_ptr<task::TaskData>&
                                    taskData) {
@@ -506,7 +506,7 @@
 
         // Call TFTP service
         crow::connections::systemBus->async_method_call(
-            [](const boost::system::error_code ec) {
+            [](const boost::system::error_code& ec) {
             if (ec)
             {
                 // messages::internalError(asyncResp->res);
@@ -603,7 +603,7 @@
             *crow::connections::systemBus, "xyz.openbmc_project.Settings",
             "/xyz/openbmc_project/software/apply_time",
             "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime",
-            [asyncResp](const boost::system::error_code ec,
+            [asyncResp](const boost::system::error_code& ec,
                         const std::string& applyTime) {
             if (ec)
             {
@@ -689,7 +689,7 @@
 
                     // Set the requested image apply time value
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec) {
+                        [asyncResp](const boost::system::error_code& ec) {
                         if (ec)
                         {
                             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -832,7 +832,7 @@
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.Software.Version",
         [asyncResp,
-         swId](const boost::system::error_code errorCode,
+         swId](const boost::system::error_code& errorCode,
                const dbus::utility::DBusPropertiesMap& propertiesList) {
         if (errorCode)
         {
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 45f384b..00b4223 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -178,7 +178,7 @@
     BMCWEB_LOG_DEBUG << "Get available Virtual Media resources.";
     crow::connections::systemBus->async_method_call(
         [name, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
@@ -218,7 +218,7 @@
 
     crow::connections::systemBus->async_method_call(
         [resName, name,
-         aResp](const boost::system::error_code ec,
+         aResp](const boost::system::error_code& ec,
                 const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
@@ -702,7 +702,7 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, secretPipe](const boost::system::error_code ec,
+        [asyncResp, secretPipe](const boost::system::error_code& ec,
                                 bool success) {
         if (ec)
         {
@@ -734,7 +734,7 @@
     if (legacy)
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
@@ -749,7 +749,7 @@
     else // proxy
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
@@ -818,7 +818,7 @@
 
         crow::connections::systemBus->async_method_call(
             [service, resName, actionParams,
-             asyncResp](const boost::system::error_code ec2,
+             asyncResp](const boost::system::error_code& ec2,
                         dbus::utility::ManagedObjectType& subtree) mutable {
             if (ec2)
             {
@@ -915,7 +915,7 @@
 
         crow::connections::systemBus->async_method_call(
             [resName, service, asyncResp{asyncResp}](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::ManagedObjectType& subtree) {
             if (ec)
             {