@@ -352,6 +352,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
352
352
PHY_INIT_MAGIC , sizeof (phy_init_magic_post )) != 0 ) {
353
353
#ifndef CONFIG_ESP32_PHY_DEFAULT_INIT_IF_INVALID
354
354
ESP_LOGE (TAG , "failed to validate PHY data partition" );
355
+ free (init_data_store );
355
356
return NULL ;
356
357
#else
357
358
ESP_LOGE (TAG , "failed to validate PHY data partition, restoring default data into flash..." );
@@ -855,18 +856,19 @@ esp_err_t esp_phy_update_country_info(const char *country)
855
856
{
856
857
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
857
858
uint8_t phy_init_data_type_map = 0 ;
858
- //if country equal s_phy_current_country, return;
859
- if (!memcmp (country , s_phy_current_country , sizeof (s_phy_current_country ))) {
860
- return ESP_OK ;
861
- }
862
-
863
- memcpy (s_phy_current_country , country , sizeof (s_phy_current_country ));
864
859
865
860
if (!s_multiple_phy_init_data_bin ) {
866
861
ESP_LOGD (TAG , "Does not support multiple PHY init data bins" );
867
862
return ESP_FAIL ;
868
863
}
869
864
865
+ //if country equal s_phy_current_country, return;
866
+ if (!memcmp (country , s_phy_current_country , sizeof (s_phy_current_country ))) {
867
+ return ESP_OK ;
868
+ }
869
+
870
+ memcpy (s_phy_current_country , country , sizeof (s_phy_current_country ));
871
+
870
872
phy_init_data_type_map = phy_find_bin_type_according_country (country );
871
873
if (phy_init_data_type_map == s_phy_init_data_type ) {
872
874
return ESP_OK ;
0 commit comments