Fix cppcheck warnings

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I18be21d5141630a1da3d5e54740b54a9a06496d9
diff --git a/inc/button_factory.hpp b/inc/button_factory.hpp
index 0d427f7..fc75f4f 100644
--- a/inc/button_factory.hpp
+++ b/inc/button_factory.hpp
@@ -46,7 +46,7 @@
      * @brief this method returns the button interface object
      *    corresponding to the button formfactor name provided
      */
-    std::unique_ptr<ButtonIface> createInstance(std::string name,
+    std::unique_ptr<ButtonIface> createInstance(const std::string& name,
                                                 sdbusplus::bus::bus& bus,
                                                 EventPtr& event,
                                                 buttonConfig& buttonCfg)
diff --git a/inc/button_handler.hpp b/inc/button_handler.hpp
index b3c65f5..baa7400 100644
--- a/inc/button_handler.hpp
+++ b/inc/button_handler.hpp
@@ -39,7 +39,7 @@
      *
      * @param[in] bus - sdbusplus connection object
      */
-    Handler(sdbusplus::bus::bus& bus);
+    explicit Handler(sdbusplus::bus::bus& bus);
 
   private:
     /**
diff --git a/inc/button_interface.hpp b/inc/button_interface.hpp
index 0a0181b..9d85e8e 100644
--- a/inc/button_interface.hpp
+++ b/inc/button_interface.hpp
@@ -108,8 +108,8 @@
         }
     }
 
-    buttonConfig config;
     sdbusplus::bus::bus& bus;
     EventPtr& event;
+    buttonConfig config;
     sd_event_io_handler_t callbackHandler;
 };
diff --git a/inc/common.hpp b/inc/common.hpp
index 82746ee..1b4911f 100644
--- a/inc/common.hpp
+++ b/inc/common.hpp
@@ -24,7 +24,7 @@
 {
     void operator()(sd_event* event) const
     {
-        event = sd_event_unref(event);
+        sd_event_unref(event);
     }
 };
 using EventPtr = std::unique_ptr<sd_event, EventDeleter>;