Fix various warnings generated from Coverity scan

esp_timer:
Control flow issues  (DEADCODE)
    Execution cannot reach this statement: "break;".

protocomm_httpd:
(UNUSED_VALUE)
    Assigning value from "cookie_session_id" to "cur_cookie_session_id" here, but that stored value is overwritten before it can be used.

esp_flash_api:
Null pointer dereferences  (REVERSE_INULL)
    Null-checking "chip" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
This commit is contained in:
Mahavir Jain
2021-12-07 13:21:08 +05:30
parent 13978c9556
commit 203f82cc49
4 changed files with 9 additions and 21 deletions

View File

@@ -265,12 +265,14 @@ esp_err_t IRAM_ATTR esp_flash_init_main(esp_flash_t *chip)
// 3. Get basic parameters of the chip (size, dummy count, etc.)
// 4. Init chip into desired mode (without breaking the cache!)
esp_err_t err = ESP_OK;
bool octal_mode = (chip->read_mode >= SPI_FLASH_OPI_FLAG);
bool octal_mode;
if (chip == NULL || chip->host == NULL || chip->host->driver == NULL ||
((memspi_host_inst_t*)chip->host)->spi == NULL) {
return ESP_ERR_INVALID_ARG;
}
octal_mode = (chip->read_mode >= SPI_FLASH_OPI_FLAG);
//read chip id
// This can indicate the MSPI support OPI, if the flash works on MSPI in OPI mode, we directly bypass read id.
uint32_t flash_id = 0;