[mle] change `Restore()` to return `void` (#7537)
diff --git a/src/core/common/instance.cpp b/src/core/common/instance.cpp
index bb2b4a7..5e87a7e 100644
--- a/src/core/common/instance.cpp
+++ b/src/core/common/instance.cpp
@@ -189,7 +189,7 @@
// Restore datasets and network information
Get<Settings>().Init();
- IgnoreError(Get<Mle::MleRouter>().Restore());
+ Get<Mle::MleRouter>().Restore();
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
Get<Trel::Link>().AfterInit();
diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp
index f877371..82d112e 100644
--- a/src/core/thread/mle.cpp
+++ b/src/core/thread/mle.cpp
@@ -310,9 +310,8 @@
return;
}
-Error Mle::Restore(void)
+void Mle::Restore(void)
{
- Error error = kErrorNone;
Settings::NetworkInfo networkInfo;
Settings::ParentInfo parentInfo;
@@ -323,7 +322,7 @@
Get<DuaManager>().Restore();
#endif
- SuccessOrExit(error = Get<Settings>().Read(networkInfo));
+ SuccessOrExit(Get<Settings>().Read(networkInfo));
Get<KeyManager>().SetCurrentKeySequence(networkInfo.GetKeySequence());
Get<KeyManager>().SetMleFrameCounter(networkInfo.GetMleFrameCounter());
@@ -356,9 +355,7 @@
if (!IsActiveRouter(networkInfo.GetRloc16()))
{
- error = Get<Settings>().Read(parentInfo);
-
- if (error != kErrorNone)
+ if (Get<Settings>().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 @@
}
#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 92211da..38d8f87 100644
--- a/src/core/thread/mle.hpp
+++ b/src/core/thread/mle.hpp
@@ -144,13 +144,10 @@
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.