diff --git a/src/core/common/instance.cpp b/src/core/common/instance.cpp index bb2b4a745..5e87a7e7b 100644 --- a/src/core/common/instance.cpp +++ b/src/core/common/instance.cpp @@ -189,7 +189,7 @@ void Instance::AfterInit(void) // Restore datasets and network information Get().Init(); - IgnoreError(Get().Restore()); + Get().Restore(); #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE Get().AfterInit(); diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index f877371c5..82d112e23 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -310,9 +310,8 @@ exit: return; } -Error Mle::Restore(void) +void Mle::Restore(void) { - Error error = kErrorNone; Settings::NetworkInfo networkInfo; Settings::ParentInfo parentInfo; @@ -323,7 +322,7 @@ Error Mle::Restore(void) Get().Restore(); #endif - SuccessOrExit(error = Get().Read(networkInfo)); + SuccessOrExit(Get().Read(networkInfo)); Get().SetCurrentKeySequence(networkInfo.GetKeySequence()); Get().SetMleFrameCounter(networkInfo.GetMleFrameCounter()); @@ -356,9 +355,7 @@ Error Mle::Restore(void) if (!IsActiveRouter(networkInfo.GetRloc16())) { - error = Get().Read(parentInfo); - - if (error != kErrorNone) + if (Get().Read(parentInfo) != kErrorNone) { // If the restored RLOC16 corresponds to an end-device, it // is expected that the `ParentInfo` settings to be valid @@ -390,11 +387,11 @@ Error Mle::Restore(void) } #endif - // Sucessfully restored the network information from non-volatile settings after boot. + // Successfully restored the network information from non-volatile settings after boot. mHasRestored = true; exit: - return error; + return; } Error Mle::Store(void) diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 92211da47..38d8f87ea 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -144,13 +144,10 @@ public: void Stop(void) { Stop(kUpdateNetworkDatasets); } /** - * This method restores network information from non-volatile memory. - * - * @retval kErrorNone Successfully restore the network information. - * @retval kErrorNotFound There is no valid network information stored in non-volatile memory. + * This method restores network information from non-volatile memory (if any). * */ - Error Restore(void); + void Restore(void); /** * This method stores network information into non-volatile memory.