[Core/Handler] Remove assert in getDeviceStatus ()
authorWook Song <wook16.song@samsung.com>
Mon, 10 Aug 2020 06:39:39 +0000 (15:39 +0900)
committer채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 <dongju.chae@samsung.com>
Tue, 11 Aug 2020 05:44:10 +0000 (14:44 +0900)
This patch removes assert in getDeviceStatus () and then make it returns
a negative errono when api is NULL.

Signed-off-by: Wook Song <wook16.song@samsung.com>
src/core/ne-handler.cc

index 11e2f3b..42cd402 100644 (file)
@@ -876,7 +876,9 @@ HostHandler::getDeviceStatus (npu_status *status, uint32_t *num_requests)
 {
   /** API is always set in initialize () */
   const DriverAPI * api = device_->getDriverAPI ();
-  assert (api != nullptr);
+
+  if (!api)
+    return -EINVAL;
 
   device_state_t state = api->isReady ();
   if (state == device_state_t::STATE_READY) {