@@ -349,8 +349,6 @@ IRAM_ATTR void esp_mac_bb_power_down(void)
349349
350350const esp_phy_init_data_t * esp_phy_get_init_data (void )
351351{
352- esp_err_t err = ESP_OK ;
353- const esp_partition_t * partition = NULL ;
354352#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
355353 size_t init_data_store_length = sizeof (phy_init_magic_pre ) +
356354 sizeof (esp_phy_init_data_t ) + sizeof (phy_init_magic_post );
@@ -362,7 +360,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
362360 memcpy (init_data_store , multi_phy_init_data_bin_start , init_data_store_length );
363361 ESP_LOGI (TAG , "loading embedded multiple PHY init data" );
364362#else
365- partition = esp_partition_find_first (
363+ const esp_partition_t * partition = esp_partition_find_first (
366364 ESP_PARTITION_TYPE_DATA , ESP_PARTITION_SUBTYPE_DATA_PHY , NULL );
367365 if (partition == NULL ) {
368366 ESP_LOGE (TAG , "PHY data partition not found" );
@@ -377,7 +375,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
377375 return NULL ;
378376 }
379377 // read phy data from flash
380- err = esp_partition_read (partition , 0 , init_data_store , init_data_store_length );
378+ esp_err_t err = esp_partition_read (partition , 0 , init_data_store , init_data_store_length );
381379 if (err != ESP_OK ) {
382380 ESP_LOGE (TAG , "failed to read PHY data partition (0x%x)" , err );
383381 free (init_data_store );
@@ -388,6 +386,11 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
388386 if (memcmp (init_data_store , PHY_INIT_MAGIC , sizeof (phy_init_magic_pre )) != 0 ||
389387 memcmp (init_data_store + init_data_store_length - sizeof (phy_init_magic_post ),
390388 PHY_INIT_MAGIC , sizeof (phy_init_magic_post )) != 0 ) {
389+ #if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
390+ ESP_LOGE (TAG , "failed to validate embedded PHY init data" );
391+ free (init_data_store );
392+ return NULL ;
393+ #else
391394#ifndef CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID
392395 ESP_LOGE (TAG , "failed to validate PHY data partition" );
393396 free (init_data_store );
@@ -414,6 +417,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
414417 return NULL ;
415418 }
416419#endif // CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID
420+ #endif // CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
417421 }
418422#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
419423 if ((* (init_data_store + (sizeof (phy_init_magic_pre ) + PHY_SUPPORT_MULTIPLE_BIN_OFFSET )))) {
@@ -603,7 +607,6 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
603607}
604608
605609#if CONFIG_ESP_PHY_REDUCE_TX_POWER
606- // TODO: fix the esp_phy_reduce_tx_power unused warning for esp32s2 - IDF-759
607610static void __attribute((unused )) esp_phy_reduce_tx_power (esp_phy_init_data_t * init_data )
608611{
609612 uint8_t i ;
0 commit comments