jtag/drivers/openjtag: fix clang static analyzer warnings
authorTomas Vanek <vanekt@fbl.cz>
Fri, 20 Dec 2019 22:33:55 +0000 (23:33 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Sat, 7 Mar 2020 15:29:24 +0000 (15:29 +0000)
Change-Id: I900ce8157b3e220a4647871080bb9abc772446d1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5369
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
src/jtag/drivers/openjtag.c

index 7b07813d89c9f65860c29f760735f67a7e1cb041..6131df914cff32d1f739465a078c5c412e13c565 100644 (file)
@@ -229,7 +229,7 @@ static int openjtag_buf_write_standard(
                return ERROR_JTAG_DEVICE_ERROR;
        }
 
-       *bytes_written += retval;
+       *bytes_written = retval;
 
        return ERROR_OK;
 }
@@ -652,7 +652,6 @@ static void openjtag_add_scan(uint8_t *buffer, int length, struct scan_command *
                        /* whole byte */
 
                        /* bits to transfer */
-                       bits = 7;
                        command |= (7 << 5);
                        length -= 8;
                }
@@ -690,7 +689,7 @@ static void openjtag_execute_sleep(struct jtag_command *cmd)
 
 static void openjtag_set_state(uint8_t openocd_state)
 {
-       int8_t state = openjtag_get_tap_state(openocd_state);
+       uint8_t state = openjtag_get_tap_state(openocd_state);
 
        uint8_t buf = 0;
        buf = 0x01;