From 39d62ec923dbbc60a4d9d21a2bdefa833bd265ab Mon Sep 17 00:00:00 2001 From: Patryk Lipinski Date: Fri, 19 Jan 2024 15:37:43 +0100 Subject: [PATCH] [nrf noup] Lock thread stack before factory reset This commit fix problem with thread activity interupting factory reset. This activity used to lead to "Factory reset fail: -6". Writing to cleared nvm flash pages caused the problem. Signed-off-by: Patryk Lipinski --- src/platform/Zephyr/ConfigurationManagerImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.cpp b/src/platform/Zephyr/ConfigurationManagerImpl.cpp index 69e82aba22..03048aa91f 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.cpp +++ b/src/platform/Zephyr/ConfigurationManagerImpl.cpp @@ -177,6 +177,8 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { ChipLogProgress(DeviceLayer, "Performing factory reset"); + ConnectivityMgr().ErasePersistentInfo(); + #ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS void * storage = nullptr; int status = settings_storage_get(&storage); @@ -197,8 +199,6 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { ChipLogError(DeviceLayer, "Factory reset failed: %" CHIP_ERROR_FORMAT, err.Format()); } - - ConnectivityMgr().ErasePersistentInfo(); #endif PlatformMgr().Shutdown();