EntityManager: Refactor deviceRequiresPowerOn() with early-exits

Make the state space easier to follow.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: If5c57583c01c62cb1c94ca05c1a3c7eb9be726f0
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 0472612..e122fd3 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -838,19 +838,18 @@
 static bool deviceRequiresPowerOn(const nlohmann::json& entity)
 {
     auto powerState = entity.find("PowerState");
-    if (powerState != entity.end())
+    if (powerState == entity.end())
     {
-        auto ptr = powerState->get_ptr<const std::string*>();
-        if (ptr)
-        {
-            if (*ptr == "On" || *ptr == "BiosPost")
-            {
-                return true;
-            }
-        }
+        return false;
     }
 
-    return false;
+    auto ptr = powerState->get_ptr<const std::string*>();
+    if (!ptr)
+    {
+        return false;
+    }
+
+    return *ptr == "On" || *ptr == "BiosPost";
 }
 
 void startRemovedTimer(boost::asio::steady_timer& timer,