Fix cppcheck warnings
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie007785a9afd036e964ba3457fdeb2e6097c9223
diff --git a/bmc_epoch.cpp b/bmc_epoch.cpp
index 5889ed3..92f31d8 100644
--- a/bmc_epoch.cpp
+++ b/bmc_epoch.cpp
@@ -27,7 +27,7 @@
using namespace phosphor::logging;
BmcEpoch::BmcEpoch(sdbusplus::bus::bus& bus, const char* objPath) :
- EpochBase(bus, objPath), bus(bus)
+ EpochBase(bus, objPath)
{
initialize();
}
diff --git a/bmc_epoch.hpp b/bmc_epoch.hpp
index 21cf540..b47a39b 100644
--- a/bmc_epoch.hpp
+++ b/bmc_epoch.hpp
@@ -55,9 +55,6 @@
static int onTimeChange(sd_event_source* es, int fd, uint32_t revents,
void* userdata);
- /** @brief The reference of sdbusplus bus */
- sdbusplus::bus::bus& bus;
-
/** @brief The deleter of sd_event_source */
std::function<void(sd_event_source*)> sdEventSourceDeleter =
[](sd_event_source* p) {
diff --git a/main.cpp b/main.cpp
index 2f40341..1927f4e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -10,7 +10,7 @@
auto bus = sdbusplus::bus::new_default();
sd_event* event = nullptr;
- auto eventDeleter = [](sd_event* e) { e = sd_event_unref(e); };
+ auto eventDeleter = [](sd_event* e) { sd_event_unref(e); };
using SdEvent = std::unique_ptr<sd_event, decltype(eventDeleter)>;
// acquire a reference to the default event loop
diff --git a/utils.cpp b/utils.cpp
index be29c74..95edd99 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -34,10 +34,7 @@
lg2::error("Error reading mapper response");
throw std::runtime_error("Error reading mapper response");
}
- if (mapperResponse.size() < 1)
- {
- return "";
- }
+
return mapperResponse[0].first;
}
catch (const sdbusplus::exception::exception& ex)