Merge branch 'fix/ot_used_wrong_nvs_open_api_v5.2' into 'release/v5.2'

fix(openthread): open nvs from the configured partition (v5.2)

See merge request espressif/esp-idf!44030
This commit is contained in:
Zhang Wen Xu
2025-12-31 01:50:30 +00:00

View File

@@ -130,9 +130,18 @@ static esp_err_t erase_all_key(uint16_t aKey)
void otPlatSettingsInit(otInstance *aInstance, const uint16_t *aSensitiveKeys, uint16_t aSensitiveKeysLength)
{
esp_err_t err = nvs_open(OT_NAMESPACE, NVS_READWRITE, &s_ot_nvs_handle);
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aSensitiveKeys);
OT_UNUSED_VARIABLE(aSensitiveKeysLength);
esp_err_t err = ESP_OK;
if (s_storage_name != NULL) {
err = nvs_open_from_partition(s_storage_name, OT_NAMESPACE, NVS_READWRITE, &s_ot_nvs_handle);
} else {
err = nvs_open(OT_NAMESPACE, NVS_READWRITE, &s_ot_nvs_handle);
}
if (err != ESP_OK) {
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to open NVS namespace (0x%x)", err);
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to open %s namespace (0x%x)", s_storage_name == NULL ? "nvs" : s_storage_name, err);
assert(0);
}
}