Update baremetal systick timer handling

Use the ethosuDrv pointer to signal if the systick handler
should be restarted.

Change-Id: Id47b37ab773970317ab324b95706ea54d7dcc74a
diff --git a/applications/baremetal/main.cpp b/applications/baremetal/main.cpp
index d27e4a4..20bc756 100644
--- a/applications/baremetal/main.cpp
+++ b/applications/baremetal/main.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -89,10 +89,12 @@
     // Disable systick, preventing new systick interrupt to fire while we call the Ethos-U monitor
     SysTick->CTRL = 0;
 
-    ethosuMonitor.monitorSample(ethosuDrv);
+    if (ethosuDrv != nullptr) {
+        ethosuMonitor.monitorSample(ethosuDrv);
 
-    // Restart the systick timer
-    SysTick_Config(delay);
+        // Restart the systick timer
+        SysTick_Config(delay);
+    }
 }
 
 void ethosu_inference_begin(struct ethosu_driver *drv, void *) {
@@ -105,7 +107,7 @@
     // Disable polling
     SysTick->CTRL = 0;
 
-    ethosuDrv = 0;
+    ethosuDrv = nullptr;
     ethosuMonitor.monitorSample(drv);
     ethosuMonitor.release(drv);
 }