This is an automated email from Gerrit.

"zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/8403

-- gerrit

commit 2f6b9e8fbab944aac65bd072af78f8d26809c933
Author: Marc Schink <d...@zapb.de>
Date:   Wed Jul 17 16:59:51 2024 +0200

    jtag: Use 'unsigned int' for 'ir_length'
    
    This patch modifies as little code as possible in order to simplify the
    review. Data types that are affected by these changes will be modified
    in following patches.
    
    Change-Id: I83921d70e017095d63547e0bc9fe61779191d9d0
    Signed-off-by: Marc Schink <d...@zapb.de>

diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 46ab584d92..76bfdf157b 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -107,7 +107,7 @@ struct jtag_tap {
        bool disabled_after_reset;
        /** Is this TAP currently enabled? */
        bool enabled;
-       int ir_length; /**< size of instruction register */
+       unsigned int ir_length; /**< size of instruction register */
        uint32_t ir_capture_value;
        uint8_t *expected; /**< Capture-IR expected value */
        uint32_t ir_capture_mask;
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index e534134276..9e53bbcb6a 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -448,11 +448,11 @@ static COMMAND_HELPER(handle_jtag_newtap_args, struct 
jtag_tap *tap)
                        if (!CMD_ARGC)
                                return ERROR_COMMAND_ARGUMENT_INVALID;
 
-                       COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tap->ir_length);
+                       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], tap->ir_length);
                        CMD_ARGC--;
                        CMD_ARGV++;
-                       if (tap->ir_length > (int)(8 * 
sizeof(tap->ir_capture_value)))
-                               LOG_WARNING("%s: huge IR length %d", 
tap->dotted_name, tap->ir_length);
+                       if (tap->ir_length > (8 * 
sizeof(tap->ir_capture_value)))
+                               LOG_WARNING("%s: huge IR length %u", 
tap->dotted_name, tap->ir_length);
                        break;
 
                case NTAP_OPT_IRMASK:
@@ -820,7 +820,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
                        tap->enabled ? 'Y' : 'n',
                        (unsigned int)(tap->idcode),
                        expected_id,
-                       (unsigned int)(tap->ir_length),
+                       tap->ir_length,
                        (unsigned int)(expected),
                        (unsigned int)(expected_mask));
 
@@ -972,7 +972,7 @@ COMMAND_HANDLER(handle_irscan_command)
                if (retval != ERROR_OK)
                        goto error_return;
 
-               int field_size = tap->ir_length;
+               unsigned int field_size = tap->ir_length;
                fields[i].num_bits = field_size;
                uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8));
                if (!v) {
diff --git a/src/target/avrt.c b/src/target/avrt.c
index 61bef329fe..ccce7e5e52 100644
--- a/src/target/avrt.c
+++ b/src/target/avrt.c
@@ -153,7 +153,7 @@ static int mcu_write_ir(struct jtag_tap *tap, uint8_t 
*ir_in, uint8_t *ir_out,
                LOG_ERROR("invalid tap");
                return ERROR_FAIL;
        }
-       if (ir_len != tap->ir_length) {
+       if ((unsigned int)ir_len != tap->ir_length) {
                LOG_ERROR("invalid ir_len");
                return ERROR_FAIL;
        }

-- 

Reply via email to