NVMeSensorMain: Move context definition to where it's used

The definition of sensorPtr is pretty verbose.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia773d23ba03a2c86700b05009b0946d33d35dbad
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index cae7eb3..fe4fb5b 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -168,7 +168,6 @@
         }
 
         std::vector<thresholds::Threshold> sensorThresholds;
-
         if (!parseThresholdsFromConfig(sensorData, sensorThresholds))
         {
             std::cerr << "error populating thresholds for " << *sensorName
@@ -181,13 +180,12 @@
             continue;
         }
 
-        std::shared_ptr<NVMeContext> context =
-            provideRootBusContext(io, nvmeDeviceMap, *rootBus);
-
         std::shared_ptr<NVMeSensor> sensorPtr = std::make_shared<NVMeSensor>(
             objectServer, io, dbusConnection, *sensorName,
             std::move(sensorThresholds), interfacePath, *busNumber);
 
+        std::shared_ptr<NVMeContext> context =
+            provideRootBusContext(io, nvmeDeviceMap, *rootBus);
         context->addSensor(sensorPtr);
     }
     for (const auto& [_, context] : nvmeDeviceMap)