فهرست منبع

spi_flash: Simplify init-time size check

Angus Gratton 5 سال پیش
والد
کامیت
06ec032c0c
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      components/spi_flash/esp_flash_spi_init.c

+ 4 - 4
components/spi_flash/esp_flash_spi_init.c

@@ -261,12 +261,12 @@ esp_err_t esp_flash_init_default_chip(void)
     if (default_chip.size < legacy_chip->chip_size) {
         ESP_EARLY_LOGE(TAG, "Detected size(%dk) smaller than the size in the binary image header(%dk). Probe failed.", default_chip.size/1024, legacy_chip->chip_size/1024);
         return ESP_ERR_FLASH_SIZE_NOT_MATCH;
-    } else if (default_chip.size > legacy_chip->chip_size) {
+    }
+
+    if (default_chip.size > legacy_chip->chip_size) {
         ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, legacy_chip->chip_size/1024);
-        default_chip.size = legacy_chip->chip_size;
-    } else {
-        default_chip.size = legacy_chip->chip_size;
     }
+    default_chip.size = legacy_chip->chip_size;
 
     esp_flash_default_chip = &default_chip;
     return ESP_OK;