boot/powctl/i2c: more miscellaneous fixes

This commit is contained in:
Michael Scire
2020-11-10 05:50:13 -08:00
committed by SciresM
parent affdea9244
commit b62aa044e4
6 changed files with 89 additions and 57 deletions

View File

@@ -30,8 +30,16 @@ namespace ams::i2c::driver::board::nintendo_nx::impl {
IAllocator(ams::MemoryResource *mr) : memory_resource(mr), list(), list_lock() { /* ... */ }
~IAllocator() {
/* TODO: Remove all entries, etc */
AMS_ABORT("BusAccessorManager not destructible");
std::scoped_lock lk(this->list_lock);
/* Remove all entries. */
auto it = this->list.begin();
while (it != this->list.end()) {
T *obj = std::addressof(*it);
it = this->list.erase(it);
this->memory_resource->Deallocate(obj, sizeof(T));
}
}
template<typename ...Args>