flash: nor: jtagspi: fix jtagspi_read_status() warning

Clang static analyzer says that in certain cases "Assigned value is
garbage or undefined" there.

Change-Id: Ib35a4cf7a553ba9461270a0dc4c4b9b205091e73
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4338
Tested-by: jenkins
compliance_dev
Paul Fertser 2018-01-14 19:28:20 +03:00
parent ab597027ea
commit 3c9bd7c6f3
1 changed files with 4 additions and 3 deletions

View File

@ -224,9 +224,10 @@ static int jtagspi_probe(struct flash_bank *bank)
static void jtagspi_read_status(struct flash_bank *bank, uint32_t *status) static void jtagspi_read_status(struct flash_bank *bank, uint32_t *status)
{ {
uint8_t buf; uint8_t buf;
jtagspi_cmd(bank, SPIFLASH_READ_STATUS, NULL, &buf, -8); if (jtagspi_cmd(bank, SPIFLASH_READ_STATUS, NULL, &buf, -8) == ERROR_OK) {
*status = buf; *status = buf;
/* LOG_DEBUG("status=0x%08" PRIx32, *status); */ /* LOG_DEBUG("status=0x%08" PRIx32, *status); */
}
} }
static int jtagspi_wait(struct flash_bank *bank, int timeout_ms) static int jtagspi_wait(struct flash_bank *bank, int timeout_ms)