From dec77190a1cad61ed448a6a1e54d3c6ca9963149 Mon Sep 17 00:00:00 2001 From: "restyled-io[bot]" <32688539+restyled-io[bot]@users.noreply.github.com> Date: Fri, 5 Nov 2021 12:43:34 +0200 Subject: [PATCH] Restyled by clang-format (#11464) Co-authored-by: Restyled.io Signed-off-by: Doru Gucea --- .../k32w/k32w0/KeyValueStoreManagerImpl.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/platform/nxp/k32w/k32w0/KeyValueStoreManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/KeyValueStoreManagerImpl.cpp index eae1ef68b1ca8d..5753f614a0550a 100644 --- a/src/platform/nxp/k32w/k32w0/KeyValueStoreManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/KeyValueStoreManagerImpl.cpp @@ -89,7 +89,7 @@ CHIP_ERROR RestoreFromFlash() { ChipLogProgress(DeviceLayer, "KVS, Error while restoring Matter key [%s] from flash with PDM id: %i", key_string_id, pdm_internal_id); - break; + return err; } if (key_string_id_size) @@ -162,7 +162,11 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, if (iter == g_key_ids_set.end()) { - assert(g_key_ids_set.size() < kMaxNumberOfKeys); + if (g_key_ids_set.size() >= kMaxNumberOfKeys) + { + return CHIP_ERROR_NO_MEMORY; + } + g_key_ids_set.insert(key_id); put_key = true; @@ -188,20 +192,20 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, if (err == CHIP_NO_ERROR) { pdm_internal_id = chip::DeviceLayer::Internal::K32WConfigKey(pdm_id_kvs, key_id + kMaxNumberOfKeys); - ChipLogProgress(DeviceLayer, "KVS, save in flash the Matter key [%s] with PDM id: %i", key, - pdm_internal_id); + ChipLogProgress(DeviceLayer, "KVS, save in flash the Matter key [%s] with PDM id: %i", key, pdm_internal_id); err = chip::DeviceLayer::Internal::K32WConfig::WriteConfigValueStr(pdm_internal_id, key, strlen(key)); if (err != CHIP_NO_ERROR) { - ChipLogProgress(DeviceLayer, "KVS, Error while saving in flash the Matter key [%s] with PDM id: %i", - key, pdm_internal_id); + ChipLogProgress(DeviceLayer, "KVS, Error while saving in flash the Matter key [%s] with PDM id: %i", key, + pdm_internal_id); } } else { - ChipLogProgress(DeviceLayer, "KVS, Error while saving in flash the value of the Matter key [%s] with PDM id: %i", key, pdm_internal_id); + ChipLogProgress(DeviceLayer, "KVS, Error while saving in flash the value of the Matter key [%s] with PDM id: %i", key, + pdm_internal_id); } }