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/mainloop.cpp b/mainloop.cpp
index 096e1d4..5fa6404 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -359,7 +359,6 @@
         if (attrs.find(hwmon::entry::input) != attrs.end())
         {
             // Read value from sensor.
-            int64_t value;
             std::string input = hwmon::entry::cinput;
             if (i.first.first == "pwm")
             {
@@ -368,6 +367,7 @@
 
             try
             {
+                int64_t value;
                 auto& objInfo = std::get<ObjectInfo>(i.second);
                 auto& obj = std::get<Object>(objInfo);