coding style: add parenthesis around the argument of sizeof
[fw/openocd] / src / jtag / tcl.c
index ef0cd3f53e014350ca5609c9526d32cedaba7781..f52cbd60623b46016904d7f6cf614ba254bd809a 100644 (file)
@@ -965,7 +965,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
        while (tap) {
                uint32_t expected, expected_mask, ii;
 
-               snprintf(expected_id, sizeof expected_id, "0x%08x",
+               snprintf(expected_id, sizeof(expected_id), "0x%08x",
                        (unsigned)((tap->expected_ids_cnt > 0)
                                   ? tap->expected_ids[0]
                                   : 0));
@@ -987,7 +987,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
                        (unsigned int)(expected_mask));
 
                for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
-                       snprintf(expected_id, sizeof expected_id, "0x%08x",
+                       snprintf(expected_id, sizeof(expected_id), "0x%08x",
                                (unsigned) tap->expected_ids[ii]);
                        if (tap->ignore_version)
                                expected_id[2] = '*';
@@ -1131,7 +1131,7 @@ COMMAND_HANDLER(handle_irscan_command)
                }
                int field_size = tap->ir_length;
                fields[i].num_bits = field_size;
-               uint8_t *v = malloc(DIV_ROUND_UP(field_size, 8));
+               uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8));
 
                uint64_t value;
                retval = parse_u64(CMD_ARGV[i * 2 + 1], &value);
@@ -1314,7 +1314,7 @@ static const struct command_registration jtag_command_handlers[] = {
                .name = "irscan",
                .handler = handle_irscan_command,
                .mode = COMMAND_EXEC,
-               .help = "Execute Instruction Register (DR) scan.  The "
+               .help = "Execute Instruction Register (IR) scan.  The "
                        "specified opcodes are put into each TAP's IR, "
                        "and other TAPs are put in BYPASS.",
                .usage = "[tap_name instruction]* ['-endstate' state_name]",