diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index af7754600d4cf4..53ef449d95573b 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,8 @@ DeviceController::DeviceController() CHIP_ERROR DeviceController::Init(ControllerInitParams params) { + assertChipStackLockedByCurrentThread(); + VerifyOrReturnError(mState == State::NotInitialized, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(params.systemState != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -282,6 +285,8 @@ CHIP_ERROR DeviceController::InitControllerNOCChain(const ControllerInitParams & void DeviceController::Shutdown() { + assertChipStackLockedByCurrentThread(); + VerifyOrReturn(mState != State::NotInitialized); ChipLogDetail(Controller, "Shutting down the controller");