This is an automated email from Gerrit.

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

-- gerrit

commit 095a0e79c908e081d914ae3fb41eed9262dc3349
Author: Tomas Vanek <[email protected]>
Date:   Fri Dec 20 23:23:26 2019 +0100

    flash/nor/fm4,tms470: fix clang static analyzer warnings
    
    Change-Id: I18c1501918d40453fea6aeeb6f035e46d41fc524
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/flash/nor/fm4.c b/src/flash/nor/fm4.c
index a8877b4..7e3a1c5 100644
--- a/src/flash/nor/fm4.c
+++ b/src/flash/nor/fm4.c
@@ -207,7 +207,7 @@ static int fm4_flash_write(struct flash_bank *bank, const 
uint8_t *buffer,
        uint32_t halfword_count = DIV_ROUND_UP(byte_count, 2);
        uint32_t result;
        unsigned i;
-       int retval;
+       int retval, retval2 = ERROR_OK;
        const uint8_t write_block_code[] = {
 #include "../../../contrib/loaders/flash/fm4/write.inc"
        };
@@ -327,7 +327,7 @@ static int fm4_flash_write(struct flash_bank *bank, const 
uint8_t *buffer,
 err_run_ret:
 err_run:
 err_write_data:
-       retval = fm4_enter_flash_cpu_rom_mode(target);
+       retval2 = fm4_enter_flash_cpu_rom_mode(target);
 
 err_flash_mode:
        for (i = 0; i < ARRAY_SIZE(reg_params); i++)
@@ -338,7 +338,9 @@ err_alloc_data:
 err_write_code:
        target_free_working_area(target, code_workarea);
 
-       return retval;
+       if (retval != ERROR_OK)
+               return retval;
+       return retval2;
 }
 
 static int mb9bf_probe(struct flash_bank *bank)
diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c
index 90557b8..bc16aca 100644
--- a/src/flash/nor/tms470.c
+++ b/src/flash/nor/tms470.c
@@ -709,6 +709,7 @@ static int tms470_erase_sector(struct flash_bank *bank, int 
sector)
         * Select one or more bits in FMBSEA or FMBSEB to disable Level 1
         * protection for the particular sector to be erased/written.
         */
+       assert(sector >= 0);
        if (sector < 16) {
                target_read_u32(target, 0xFFE88008, &fmbsea);
                target_write_u32(target, 0xFFE88008, fmbsea | (1 << sector));

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to