Handle error returned by IBurstContext::freeMemory

Unhandled HIDL errors result in a crash. This CL handles any errors from
IBurstContext::freeMemory by logging the error and continuing with the
rest of the function.

Bug: N/A
Test: mma
Change-Id: Ic433a627137df4d275a1b0d2d800d592afc1a18c
This commit is contained in:
Michael Butler 2021-10-13 11:28:26 -07:00
parent 176144714e
commit 1b09ea9224

View file

@ -176,7 +176,10 @@ void ExecutionBurstController::MemoryCache::freeMemory(const nn::SharedMemory& m
std::lock_guard guard(mMutex); std::lock_guard guard(mMutex);
const int32_t slot = mMemoryIdToSlot.at(memory); const int32_t slot = mMemoryIdToSlot.at(memory);
if (mBurstContext) { if (mBurstContext) {
mBurstContext->freeMemory(slot); const auto ret = mBurstContext->freeMemory(slot);
if (!ret.isOk()) {
LOG(ERROR) << "IBustContext::freeMemory failed: " << ret.description();
}
} }
mMemoryIdToSlot.erase(memory); mMemoryIdToSlot.erase(memory);
mMemoryCache[slot] = {}; mMemoryCache[slot] = {};