summaryrefslogtreecommitdiff
path: root/nn
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-04-23 10:14:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-04-23 10:14:58 +0000
commit597ec94dd22dcbecc0d1db3646c910b12ae5bb87 (patch)
treeae9c1164a76d212174087d700e1b439408249ce3 /nn
parent56a09d4da981c00ce9709abad6c5d34325e18ea6 (diff)
parenta144106df8f9b82251a5e584b1b083fb39d33b88 (diff)
downloadml-597ec94dd22dcbecc0d1db3646c910b12ae5bb87.tar.gz
Merge "Error code fix and added new (std::nothrow) where needed." into pi-dev
Diffstat (limited to 'nn')
-rw-r--r--nn/runtime/CompilationBuilder.cpp2
-rw-r--r--nn/runtime/Memory.cpp2
-rw-r--r--nn/runtime/ModelBuilder.cpp2
-rw-r--r--nn/runtime/NeuralNetworks.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/nn/runtime/CompilationBuilder.cpp b/nn/runtime/CompilationBuilder.cpp
index b9d125860..055b16c6f 100644
--- a/nn/runtime/CompilationBuilder.cpp
+++ b/nn/runtime/CompilationBuilder.cpp
@@ -103,7 +103,7 @@ int CompilationBuilder::createExecution(ExecutionBuilder **execution) {
*execution = nullptr;
return ANEURALNETWORKS_BAD_STATE;
}
- *execution = new ExecutionBuilder(this);
+ *execution = new (std::nothrow) ExecutionBuilder(this);
return (*execution ? ANEURALNETWORKS_NO_ERROR : ANEURALNETWORKS_OUT_OF_MEMORY);
}
diff --git a/nn/runtime/Memory.cpp b/nn/runtime/Memory.cpp
index 8f76b76d5..55dca75bb 100644
--- a/nn/runtime/Memory.cpp
+++ b/nn/runtime/Memory.cpp
@@ -29,7 +29,7 @@ int Memory::create(uint32_t size) {
mMemory = mapMemory(mHidlMemory);
if (mMemory == nullptr) {
LOG(ERROR) << "Memory::create failed";
- return ANEURALNETWORKS_OP_FAILED;
+ return ANEURALNETWORKS_OUT_OF_MEMORY;
}
return ANEURALNETWORKS_NO_ERROR;
}
diff --git a/nn/runtime/ModelBuilder.cpp b/nn/runtime/ModelBuilder.cpp
index d136f5b48..f8c318eca 100644
--- a/nn/runtime/ModelBuilder.cpp
+++ b/nn/runtime/ModelBuilder.cpp
@@ -301,7 +301,7 @@ int ModelBuilder::createCompilation(CompilationBuilder** compilation) {
*compilation = nullptr;
return ANEURALNETWORKS_BAD_STATE;
}
- *compilation = new CompilationBuilder(this);
+ *compilation = new (std::nothrow) CompilationBuilder(this);
return (*compilation ? ANEURALNETWORKS_NO_ERROR : ANEURALNETWORKS_OUT_OF_MEMORY);
}
diff --git a/nn/runtime/NeuralNetworks.cpp b/nn/runtime/NeuralNetworks.cpp
index 9a3c421f9..265f15432 100644
--- a/nn/runtime/NeuralNetworks.cpp
+++ b/nn/runtime/NeuralNetworks.cpp
@@ -276,7 +276,7 @@ int ANeuralNetworksModel_create(ANeuralNetworksModel** model) {
LOG(ERROR) << "ANeuralNetworksModel_create passed a nullptr";
return ANEURALNETWORKS_UNEXPECTED_NULL;
}
- ModelBuilder* m = new ModelBuilder();
+ ModelBuilder* m = new (std::nothrow) ModelBuilder();
if (m == nullptr) {
*model = nullptr;
return ANEURALNETWORKS_OUT_OF_MEMORY;