diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 6c91b25a1..471269b8b 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -111,7 +111,8 @@ constexpr Interpreter::Command Interpreter::sCommands[]; Interpreter *Interpreter::sInterpreter = nullptr; Interpreter::Interpreter(Instance *aInstance) - : mUserCommands(nullptr) + : mInstance(aInstance) + , mUserCommands(nullptr) , mUserCommandsLength(0) , mPingLength(kDefaultPingLength) , mPingCount(kDefaultPingCount) @@ -147,7 +148,6 @@ Interpreter::Interpreter(Instance *aInstance) #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE , mSrpServer(*this) #endif - , mInstance(aInstance) { #if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE otThreadSetReceiveDiagnosticGetCallback(mInstance, &Interpreter::HandleDiagnosticGetResponse, this); diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 0497f1d09..7c12afe1d 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -775,6 +775,7 @@ private: static_assert(Utils::LookupTable::IsSorted(sCommands), "Command Table is not sorted"); + Instance * mInstance; const otCliCommand *mUserCommands; uint8_t mUserCommandsLength; void * mUserCommandsContext; @@ -823,8 +824,6 @@ private: #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE SrpServer mSrpServer; #endif - - Instance *mInstance; }; } // namespace Cli