spi_flash: Simplify init-time size check

This commit is contained in:
Angus Gratton
2020-12-17 10:28:03 +11:00
parent 0736c91d68
commit 06ec032c0c

View File

@ -261,13 +261,13 @@ 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) {
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;
}
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;
esp_flash_default_chip = &default_chip;
return ESP_OK;
}