This is an automated email from Gerrit.

Paul Fertser ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/4338

-- gerrit

commit 5e59e4bbedcb0e7bebcd556bf0a42ce222f13729
Author: Paul Fertser <[email protected]>
Date:   Sun Jan 14 19:28:20 2018 +0300

    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 <[email protected]>

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)

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to