diff options
author | Paul Fertser <fercerpav@gmail.com> | 2018-01-14 19:28:20 +0300 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2018-01-30 07:36:51 +0000 |
commit | 3c9bd7c6f30a34e3930e44dd2e8ce5f5a877b4eb (patch) | |
tree | e86027fde829390b0736b1f6ca219b6a3e902127 /src/flash | |
parent | ab597027ea98d4fa39980f9674dced42b5193b79 (diff) | |
download | riscv-openocd-3c9bd7c6f30a34e3930e44dd2e8ce5f5a877b4eb.zip riscv-openocd-3c9bd7c6f30a34e3930e44dd2e8ce5f5a877b4eb.tar.gz riscv-openocd-3c9bd7c6f30a34e3930e44dd2e8ce5f5a877b4eb.tar.bz2 |
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
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/nor/jtagspi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/flash/nor/jtagspi.c b/src/flash/nor/jtagspi.c index a05ff37..a73812d 100644 --- a/src/flash/nor/jtagspi.c +++ b/src/flash/nor/jtagspi.c @@ -224,9 +224,10 @@ static int jtagspi_probe(struct flash_bank *bank) static void jtagspi_read_status(struct flash_bank *bank, uint32_t *status) { uint8_t buf; - jtagspi_cmd(bank, SPIFLASH_READ_STATUS, NULL, &buf, -8); - *status = buf; - /* LOG_DEBUG("status=0x%08" PRIx32, *status); */ + if (jtagspi_cmd(bank, SPIFLASH_READ_STATUS, NULL, &buf, -8) == ERROR_OK) { + *status = buf; + /* LOG_DEBUG("status=0x%08" PRIx32, *status); */ + } } static int jtagspi_wait(struct flash_bank *bank, int timeout_ms) |