cleanup: reduced scope of variables

Cppcheck CI tool identified many variables whose scope could be reduced.

Change-Id: I1478b5680adc560d08bc74ffc91929b1d19e24fa
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/targets.hpp b/targets.hpp
index 317eec5..9e63351 100644
--- a/targets.hpp
+++ b/targets.hpp
@@ -69,9 +69,7 @@
 {
     std::shared_ptr<T> target;
     namespace fs = std::experimental::filesystem;
-    static constexpr bool deferSignals = true;
 
-    auto& bus = *std::get<sdbusplus::bus::bus*>(info);
     auto& obj = std::get<Object>(info);
     auto& objPath = std::get<std::string>(info);
     auto type = Targets<T>::type;
@@ -159,6 +157,9 @@
                     phosphor::logging::entry("FILE=%s", sysfsFullPath.c_str()));
             }
 
+            static constexpr bool deferSignals = true;
+            auto& bus = *std::get<sdbusplus::bus::bus*>(info);
+
             // ioAccess.path() is a path like: /sys/class/hwmon/hwmon1
             target = std::make_shared<T>(
                 std::move(std::make_unique<hwmonio::HwmonIO>(ioAccess.path())),