Fix shadowed variable issues

This patchset is the conclusion of a multi-year effort to try to fix
shadowed variable names.  Variables seem to be shadowed all over, and in
most places they exist, there's a "code smell" of things that aren't
doing what the author intended.

This commit attempts to clean up these in several ways by:
1. Renaming variables where appropriate.
2. Preferring to refer to member variables directly when operating
   within a class
3. Rearranging code so that pass through variables are handled in the
   calling scope, rather than passing them through.

These patterns are applied throughout the codebase, to the point where
-Wshadow can be enabled in meson.build.

Tested: Code compiles, unit tests pass.  Still need to run redfish
service validator.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If703398c2282f9e096ca2694fd94515de36a098b
diff --git a/redfish-core/include/query.hpp b/redfish-core/include/query.hpp
index 4c7e2f4..df61aef 100644
--- a/redfish-core/include/query.hpp
+++ b/redfish-core/include/query.hpp
@@ -50,8 +50,8 @@
         asyncResp->res.releaseCompleteRequestHandler();
     asyncResp->res.setCompleteRequestHandler(
         [&app, handler(std::move(handler)),
-         query{*queryOpt}](crow::Response& res) mutable {
-        processAllParams(app, query, handler, res);
+         query{*queryOpt}](crow::Response& resIn) mutable {
+        processAllParams(app, query, handler, resIn);
     });
     return true;
 }
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 7282413..e221a86 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -470,9 +470,9 @@
     // allows callers to attach sub-responses within the json tree that need
     // to be executed and filled into their appropriate locations.  This
     // class manages the final "merge" of the json resources.
-    MultiAsyncResp(crow::App& app,
+    MultiAsyncResp(crow::App& appIn,
                    std::shared_ptr<bmcweb::AsyncResp> finalResIn) :
-        app(app),
+        app(appIn),
         finalRes(std::move(finalResIn))
     {}
 
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 724d5f3..cfa1832 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -319,9 +319,9 @@
                         *crow::connections::systemBus, connectionName, path,
                         assetTagInterface, "AssetTag",
                         [asyncResp, chassisId(std::string(chassisId))](
-                            const boost::system::error_code ec,
+                            const boost::system::error_code ec2,
                             const std::string& property) {
-                        if (ec)
+                        if (ec2)
                         {
                             BMCWEB_LOG_DEBUG
                                 << "DBus response error for AssetTag";
@@ -615,11 +615,11 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code ec2) {
             // Use "Set" method to set the property value.
-            if (ec)
+            if (ec2)
             {
-                BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec;
+                BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec2;
                 messages::internalError(asyncResp->res);
                 return;
             }
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 7b1d1da..f15fb0b 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1871,8 +1871,8 @@
         // An addition could be a Redfish Setting like
         // ActiveSoftwareImageApplyTime and support OnReset
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2) {
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-Bus response error setting.";
                 messages::internalError(aResp->res);
@@ -2061,9 +2061,9 @@
                             const std::shared_ptr<bmcweb::AsyncResp>& aRsp) {
             aRsp->res.jsonValue["Links"]["ManagerForChassis@odata.count"] = 1;
             nlohmann::json::array_t managerForChassis;
-            nlohmann::json::object_t manager;
-            manager["@odata.id"] = "/redfish/v1/Chassis/" + chassisId;
-            managerForChassis.push_back(std::move(manager));
+            nlohmann::json::object_t managerObj;
+            managerObj["@odata.id"] = "/redfish/v1/Chassis/" + chassisId;
+            managerForChassis.push_back(std::move(managerObj));
             aRsp->res.jsonValue["Links"]["ManagerForChassis"] =
                 std::move(managerForChassis);
             aRsp->res.jsonValue["Links"]["ManagerInChassis"]["@odata.id"] =
@@ -2133,10 +2133,10 @@
                     "xyz.openbmc_project.Inventory.Decorator.Asset")
                 {
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec,
+                        [asyncResp](const boost::system::error_code ec2,
                                     const dbus::utility::DBusPropertiesMap&
                                         propertiesList) {
-                        if (ec)
+                        if (ec2)
                         {
                             BMCWEB_LOG_DEBUG << "Can't get bmc asset!";
                             return;
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index 74636dd..b93483c 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -115,11 +115,11 @@
             sdbusplus::asio::getProperty<telemetry::TimestampReadings>(
                 *crow::connections::systemBus, telemetry::service, reportPath,
                 telemetry::reportInterface, "Readings",
-                [asyncResp, id](const boost::system::error_code ec,
+                [asyncResp, id](const boost::system::error_code ec2,
                                 const telemetry::TimestampReadings& ret) {
-                if (ec)
+                if (ec2)
                 {
-                    BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+                    BMCWEB_LOG_ERROR << "respHandler DBus error " << ec2;
                     messages::internalError(asyncResp->res);
                     return;
                 }
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index 8f45fca..88333fc 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -96,10 +96,11 @@
     }
 
     nlohmann::json metrics = nlohmann::json::array();
-    for (const auto& [sensorPath, operationType, id, metadata] : *readingParams)
+    for (const auto& [sensorPath, operationType, metricId, metadata] :
+         *readingParams)
     {
         metrics.push_back({
-            {"MetricId", id},
+            {"MetricId", metricId},
             {"MetricProperties", {metadata}},
         });
     }
@@ -254,8 +255,8 @@
 {
   public:
     AddReport(AddReportArgs argsIn,
-              const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) :
-        asyncResp(asyncResp),
+              const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) :
+        asyncResp(asyncRespIn),
         args{std::move(argsIn)}
     {}
     ~AddReport()
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 8e921d7..89f0334 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -194,9 +194,9 @@
             asyncResp->res.jsonValue[protocolName]["ProtocolEnabled"] =
                 isProtocolEnabled;
             getPortNumber(socketPath, [asyncResp, protocolName](
-                                          const boost::system::error_code ec,
+                                          const boost::system::error_code ec2,
                                           int portNumber) {
-                if (ec)
+                if (ec2)
                 {
                     messages::internalError(asyncResp->res);
                     return;
@@ -272,8 +272,8 @@
                     }
 
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec) {
-                        if (ec)
+                        [asyncResp](const boost::system::error_code ec2) {
+                        if (ec2)
                         {
                             messages::internalError(asyncResp->res);
                             return;
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 1e04393..a8cfb68 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -581,13 +581,13 @@
                     "xyz.openbmc_project.Inventory.Item.Cpu."
                     "OperatingConfig",
                     "BaseSpeedPrioritySettings",
-                    [aResp](const boost::system::error_code ec,
+                    [aResp](const boost::system::error_code ec2,
                             const BaseSpeedPrioritySettingsProperty&
                                 baseSpeedList) {
-                    if (ec)
+                    if (ec2)
                     {
                         BMCWEB_LOG_WARNING << "D-Bus Property Get error: "
-                                           << ec;
+                                           << ec2;
                         messages::internalError(aResp->res);
                         return;
                     }
@@ -731,7 +731,7 @@
             // matching objects. Assume all interfaces we want to process
             // must be on the same object path.
 
-            handler(resp, processorId, objectPath, serviceMap);
+            handler(objectPath, serviceMap);
             return;
         }
         messages::resourceNotFound(resp->res, "Processor", processorId);
@@ -1218,7 +1218,9 @@
         asyncResp->res.jsonValue["@odata.id"] =
             "/redfish/v1/Systems/system/Processors/" + processorId;
 
-        getProcessorObject(asyncResp, processorId, getProcessorData);
+        getProcessorObject(
+            asyncResp, processorId,
+            std::bind_front(getProcessorData, asyncResp, processorId));
         });
 
     BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Processors/<str>/")
@@ -1249,17 +1251,10 @@
             }
             // Check for 404 and find matching D-Bus object, then run
             // property patch handlers if that all succeeds.
-            getProcessorObject(
-                asyncResp, processorId,
-                [appliedConfigUri = std::move(appliedConfigUri)](
-                    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                    const std::string& processorId,
-                    const std::string& objectPath,
-                    const dbus::utility::MapperServiceMap& serviceMap) {
-                patchAppliedOperatingConfig(asyncResp, processorId,
-                                            appliedConfigUri, objectPath,
-                                            serviceMap);
-                });
+            getProcessorObject(asyncResp, processorId,
+                               std::bind_front(patchAppliedOperatingConfig,
+                                               asyncResp, processorId,
+                                               appliedConfigUri));
         }
         });
 }
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 09e21e8..ca842d9 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -192,35 +192,35 @@
         const std::string dbusPath;
     };
 
-    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
                      const std::string& chassisIdIn,
                      std::span<std::string_view> typesIn,
                      std::string_view subNode) :
-        asyncResp(asyncResp),
+        asyncResp(asyncRespIn),
         chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode),
         efficientExpand(false)
     {}
 
     // Store extra data about sensor mapping and return it in callback
-    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
                      const std::string& chassisIdIn,
                      std::span<std::string_view> typesIn,
                      std::string_view subNode,
                      DataCompleteCb&& creationComplete) :
-        asyncResp(asyncResp),
+        asyncResp(asyncRespIn),
         chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode),
         efficientExpand(false), metadata{std::vector<SensorData>()},
         dataComplete{std::move(creationComplete)}
     {}
 
     // sensor collections expand
-    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
                      const std::string& chassisIdIn,
                      const std::span<std::string_view> typesIn,
-                     const std::string_view& subNode, bool efficientExpand) :
-        asyncResp(asyncResp),
+                     const std::string_view& subNode, bool efficientExpandIn) :
+        asyncResp(asyncRespIn),
         chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode),
-        efficientExpand(efficientExpand)
+        efficientExpand(efficientExpandIn)
     {}
 
     ~SensorsAsyncResp()
@@ -1249,8 +1249,8 @@
                         sensorsAsyncResp->asyncResp->res.jsonValue["Fans"];
                     for (const std::string& item : *collection)
                     {
-                        sdbusplus::message::object_path path(item);
-                        std::string itemName = path.filename();
+                        sdbusplus::message::object_path itemPath(item);
+                        std::string itemName = itemPath.filename();
                         if (itemName.empty())
                         {
                             continue;
@@ -1266,11 +1266,11 @@
                             });
                         if (schemaItem != fanRedfish.end())
                         {
-                            nlohmann::json::object_t collection;
-                            collection["@odata.id"] =
+                            nlohmann::json::object_t collectionId;
+                            collectionId["@odata.id"] =
                                 (*schemaItem)["@odata.id"];
                             redfishCollection.emplace_back(
-                                std::move(collection));
+                                std::move(collectionId));
                         }
                         else
                         {
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index ecdf8b2..cab23a2 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -184,7 +184,7 @@
                     // Redfish properties with same name and a
                     // string value
                     const std::string& propertyName = property.first;
-                    nlohmann::json& object =
+                    nlohmann::json& controller =
                         asyncResp->res.jsonValue["StorageControllers"][index];
                     if ((propertyName == "PartNumber") ||
                         (propertyName == "SerialNumber") ||
@@ -199,7 +199,7 @@
                             messages::internalError(asyncResp->res);
                             return;
                         }
-                        object[propertyName] = *value;
+                        controller[propertyName] = *value;
                     }
                 }
                 },
@@ -650,8 +650,8 @@
                 std::vector<std::string> leafNames;
                 for (const auto& drive : resp)
                 {
-                    sdbusplus::message::object_path path(drive);
-                    leafNames.push_back(path.filename());
+                    sdbusplus::message::object_path drivePath(drive);
+                    leafNames.push_back(drivePath.filename());
                 }
 
                 std::sort(leafNames.begin(), leafNames.end(),
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 0e00341..7180b09 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1246,11 +1246,11 @@
         sdbusplus::asio::getProperty<bool>(
             *crow::connections::systemBus, serv, path,
             "xyz.openbmc_project.Control.TPM.Policy", "TPMEnable",
-            [aResp](const boost::system::error_code ec, bool tpmRequired) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2, bool tpmRequired) {
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get"
-                                 << ec;
+                                 << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -1336,12 +1336,12 @@
 
         // Valid TPM Enable object found, now setting the value
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2) {
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG
                     << "DBUS response error: Set TrustedModuleRequiredToBoot"
-                    << ec;
+                    << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -1468,10 +1468,10 @@
     BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
-        if (ec)
+        [aResp](const boost::system::error_code ec2) {
+        if (ec2)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
             messages::internalError(aResp->res);
             return;
         }
@@ -1942,12 +1942,12 @@
         sdbusplus::asio::getProperty<std::string>(
             *crow::connections::systemBus, service, path,
             "xyz.openbmc_project.Control.Power.Mode", "PowerMode",
-            [aResp](const boost::system::error_code ec,
+            [aResp](const boost::system::error_code ec2,
                     const std::string& pmode) {
-            if (ec)
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error on PowerMode Get: "
-                                 << ec;
+                                 << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -2069,8 +2069,8 @@
 
         // Set the Power Mode property
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2) {
+            if (ec2)
             {
                 messages::internalError(aResp->res);
                 return;
@@ -2419,12 +2419,12 @@
 
         // Valid IdlePowerSaver object found, now read the current values
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec,
+            [aResp](const boost::system::error_code ec2,
                     ipsPropertiesType& properties) {
-            if (ec)
+            if (ec2)
             {
                 BMCWEB_LOG_ERROR
-                    << "DBUS response error on IdlePowerSaver GetAll: " << ec;
+                    << "DBUS response error on IdlePowerSaver GetAll: " << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -2522,10 +2522,10 @@
         if (ipsEnable)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2537,10 +2537,10 @@
         if (ipsEnterUtil)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2555,10 +2555,10 @@
             // 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 ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2571,10 +2571,10 @@
         if (ipsExitUtil)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2589,10 +2589,10 @@
             // 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 ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2636,7 +2636,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 ec2,
                         const std::string& /*hostName*/) {
             nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
             ifaceArray = nlohmann::json::array();
@@ -2646,7 +2646,7 @@
             system["@odata.id"] = "/redfish/v1/Systems/system";
             ifaceArray.push_back(std::move(system));
             count = ifaceArray.size();
-            if (!ec)
+            if (!ec2)
             {
                 BMCWEB_LOG_DEBUG << "Hypervisor is available";
                 nlohmann::json::object_t hypervisor;
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 33769a0..c9fb4a1 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -141,10 +141,10 @@
                             {
                                 if (property.first == "Activation")
                                 {
-                                    const std::string* state =
+                                    const std::string* activationState =
                                         std::get_if<std::string>(
                                             &property.second);
-                                    if (state == nullptr)
+                                    if (activationState == nullptr)
                                     {
                                         taskData->messages.emplace_back(
                                             messages::internalError());
@@ -201,10 +201,10 @@
                             {
                                 if (property.first == "Progress")
                                 {
-                                    const std::string* progress =
+                                    const std::string* progressStr =
                                         std::get_if<std::string>(
                                             &property.second);
-                                    if (progress == nullptr)
+                                    if (progressStr == nullptr)
                                     {
                                         taskData->messages.emplace_back(
                                             messages::internalError());
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index aba98e95..4f6fad9 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -54,10 +54,10 @@
  * @brief Read all known properties from VM object interfaces
  */
 inline void
-    vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interface,
+    vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interfaces,
                            const std::shared_ptr<bmcweb::AsyncResp>& aResp)
 {
-    for (const auto& [interface, values] : interface)
+    for (const auto& [interface, values] : interfaces)
     {
         if (interface == "xyz.openbmc_project.VirtualMedia.MountPoint")
         {
@@ -595,8 +595,8 @@
   public:
     using unix_fd = sdbusplus::message::unix_fd;
 
-    Pipe(boost::asio::io_context& io, Buffer&& buffer) :
-        impl(io), buffer{std::move(buffer)}
+    Pipe(boost::asio::io_context& io, Buffer&& bufferIn) :
+        impl(io), buffer{std::move(bufferIn)}
     {}
 
     ~Pipe()
@@ -830,9 +830,9 @@
 
         crow::connections::systemBus->async_method_call(
             [service, resName, actionParams,
-             asyncResp](const boost::system::error_code ec,
+             asyncResp](const boost::system::error_code ec2,
                         dbus::utility::ManagedObjectType& subtree) mutable {
-            if (ec)
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error";
 
@@ -915,11 +915,11 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp,
-         resName](const boost::system::error_code ec,
+         resName](const boost::system::error_code ec2,
                   const dbus::utility::MapperGetObject& getObjectType) {
-        if (ec)
+        if (ec2)
         {
-            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec2;
             messages::internalError(asyncResp->res);
 
             return;