fix(spi_flash): Return false directly in suspend caps check

This commit is contained in:
C.S.M
2025-03-07 11:18:39 +08:00
parent e4cf819104
commit ae50c71222

View File

@ -1442,10 +1442,12 @@ esp_err_t esp_flash_suspend_cmd_init(esp_flash_t* chip)
ESP_EARLY_LOGW(TAG, "Flash suspend feature is enabled"); ESP_EARLY_LOGW(TAG, "Flash suspend feature is enabled");
if (chip->chip_drv->get_chip_caps == NULL) { if (chip->chip_drv->get_chip_caps == NULL) {
// chip caps get failed, pass the flash capability check. // chip caps get failed, pass the flash capability check.
ESP_EARLY_LOGW(TAG, "get_chip_caps function pointer hasn't been initialized"); ESP_EARLY_LOGE(TAG, "get_chip_caps function pointer hasn't been initialized");
return ESP_ERR_INVALID_ARG;
} else { } else {
if ((chip->chip_drv->get_chip_caps(chip) & SPI_FLASH_CHIP_CAP_SUSPEND) == 0) { if ((chip->chip_drv->get_chip_caps(chip) & SPI_FLASH_CHIP_CAP_SUSPEND) == 0) {
ESP_EARLY_LOGW(TAG, "Suspend and resume may not supported for this flash model yet."); ESP_EARLY_LOGE(TAG, "Suspend and resume may not supported for this flash model yet.");
return ESP_ERR_NOT_SUPPORTED;
} }
} }
return chip->chip_drv->sus_setup(chip); return chip->chip_drv->sus_setup(chip);