Fix some gcc warnings and style suggestions

Building against gcc-10 produced warnings and style suggestions.
Fixed all the warnings, but only select style suggestions due to
readability and others appeared to be compiler confusion.

Tested: Compiled
    No functional impacts appear to have been made with these changes

Change-Id: I1adcce355b831ae8b178bfba9b89cc18fe4f3cf7
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/presence/tach.cpp b/presence/tach.cpp
index ee35878..3372d8e 100644
--- a/presence/tach.cpp
+++ b/presence/tach.cpp
@@ -119,12 +119,11 @@
 void Tach::propertiesChanged(size_t sensor,
                              const util::Properties<int64_t>& props)
 {
-    auto& s = state[sensor];
-
     // Find the Value property containing the speed.
     auto it = props.find(tachProperty);
     if (it != props.end())
     {
+        auto& s = state[sensor];
         std::get<int64_t>(s) = std::get<int64_t>(it->second);
 
         auto newState =