[Fix] Fix coverity issues
authorJiho Chu <jiho.chu@samsung.com>
Mon, 22 Aug 2022 01:46:07 +0000 (10:46 +0900)
committer추지호/NPU Lab(SR)/삼성전자 <jiho.chu@samsung.com>
Mon, 22 Aug 2022 10:07:11 +0000 (19:07 +0900)
Issues:
WGID 1603142 (http://10.113.139.115:8081/reports.htm#v19172/p10565)
WGID 1227123 (http://10.113.139.115:8081/reports.htm#v19172/p10565)

Signed-off-by: Jiho Chu <jiho.chu@samsung.com>
src/core/npu/NPUdrvAPI_emul.cc
utils/trinity_cuse/trinity-cuse-triv2.cc

index e65a96d039d1e3b6efcde2270839fa80184689cb..9654e35ede9167de72130a4acbf25f2358252d34 100644 (file)
@@ -759,6 +759,7 @@ TrinityEmulAPI::runInput (input_config_t *input_config) const {
       } else {
         logerr (TAG, "Invalid model version: minor(%d)(%d)\n", model->version, NPU_VERSION_MINOR(model->version));
         delete[] segt;
+        delete req;
         return -EINVAL;
       }
 
index 467ee62d33827097da60bcdf1b7b2f4b97935422..452a200ce13bbb40beaf14c0eaca6ebbd6f0aeea 100644 (file)
@@ -196,7 +196,7 @@ class EmulModel {
 class EmulProfile {
  public:
   EmulProfile (int req_id, const std::string &prof_path)
-      : req_id_ (req_id), prof_path_ (prof_path) {
+      : req_id_ (req_id), exec_seq_(0), prof_path_ (prof_path) {
     memset (&profile_, '\x00', sizeof (profile_));
   }
 
@@ -829,7 +829,18 @@ triv2_run_input (trinity_cuse_context *ctx, const trinity_cuse_input *in, trinit
   triv2_get_tops (ctx, &tops);
 
   std::string cmd_path (ctx->prefix_share);
-  cmd_path += "/mRPsim/triv-4.0.0.cmd";
+  if (model->getVersion () == 3) {
+    if (tops == 2)
+      cmd_path += "/mRPsim/triv2_2tops.cmd";
+    else
+      cmd_path += "/mRPsim/triv2.cmd";
+  } else if (model->getVersion () == 4) {
+    cmd_path += "/mRPsim/triv-4.0.0.cmd";
+  } else {
+    std::cerr << "Invalid model version: " << model->getVersion () << std::endl;
+    delete[] segt;
+    return -EINVAL;
+  }
 
   int req_id = in->req_id;
   std::string prof_path (ctx->prefix_profile);