This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8496

-- gerrit

commit cb720df6ca0b056573256e31aa8502f78972179f
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Mon Sep 16 11:55:20 2024 +0200

    OpenOCD: drop comparison with true/false
    
    Fix checkpatch errors:
    
            ERROR:BOOL_COMPARISON: Using comparison to true/false is
            error prone
    
    While there,
    - drop useless parenthesis,
    - drop unnecessary else after a return.
    
    Change-Id: I1234737b3e65bd10df5e938d1c36f9abaf02d348
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/flash/nor/psoc6.c b/src/flash/nor/psoc6.c
index 47f3ac6980..662910aa04 100644
--- a/src/flash/nor/psoc6.c
+++ b/src/flash/nor/psoc6.c
@@ -487,7 +487,7 @@ static int psoc6_get_info(struct flash_bank *bank, struct 
command_invocation *cm
 {
        struct psoc6_target_info *psoc6_info = bank->driver_priv;
 
-       if (psoc6_info->is_probed == false)
+       if (!psoc6_info->is_probed)
                return ERROR_FAIL;
 
        int hr = get_silicon_id(bank->target, &psoc6_info->silicon_id, 
&psoc6_info->protection);
diff --git a/src/flash/nor/xcf.c b/src/flash/nor/xcf.c
index 1d67b09430..4011fa42be 100644
--- a/src/flash/nor/xcf.c
+++ b/src/flash/nor/xcf.c
@@ -143,28 +143,27 @@ static int isc_enter(struct flash_bank *bank)
 
        struct xcf_status status = read_status(bank);
 
-       if (true == status.isc_mode)
+       if (status.isc_mode)
                return ERROR_OK;
-       else {
-               struct scan_field scan;
 
-               scan.check_mask = NULL;
-               scan.check_value = NULL;
-               scan.num_bits = 16;
-               scan.out_value = cmd_isc_enable;
-               scan.in_value = NULL;
+       struct scan_field scan;
 
-               jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
-               jtag_execute_queue();
+       scan.check_mask = NULL;
+       scan.check_value = NULL;
+       scan.num_bits = 16;
+       scan.out_value = cmd_isc_enable;
+       scan.in_value = NULL;
 
-               status = read_status(bank);
-               if (!status.isc_mode) {
-                       LOG_ERROR("*** XCF: FAILED to enter ISC mode");
-                       return ERROR_FLASH_OPERATION_FAILED;
-               }
+       jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
+       jtag_execute_queue();
 
-               return ERROR_OK;
+       status = read_status(bank);
+       if (!status.isc_mode) {
+               LOG_ERROR("*** XCF: FAILED to enter ISC mode");
+               return ERROR_FLASH_OPERATION_FAILED;
        }
+
+       return ERROR_OK;
 }
 
 static int isc_leave(struct flash_bank *bank)
@@ -174,27 +173,26 @@ static int isc_leave(struct flash_bank *bank)
 
        if (!status.isc_mode)
                return ERROR_OK;
-       else {
-               struct scan_field scan;
-
-               scan.check_mask = NULL;
-               scan.check_value = NULL;
-               scan.num_bits = 16;
-               scan.out_value = cmd_isc_disable;
-               scan.in_value = NULL;
-
-               jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
-               jtag_execute_queue();
-               alive_sleep(1); /* device needs 50 uS to leave ISC mode */
-
-               status = read_status(bank);
-               if (status.isc_mode) {
-                       LOG_ERROR("*** XCF: FAILED to leave ISC mode");
-                       return ERROR_FLASH_OPERATION_FAILED;
-               }
 
-               return ERROR_OK;
+       struct scan_field scan;
+
+       scan.check_mask = NULL;
+       scan.check_value = NULL;
+       scan.num_bits = 16;
+       scan.out_value = cmd_isc_disable;
+       scan.in_value = NULL;
+
+       jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
+       jtag_execute_queue();
+       alive_sleep(1); /* device needs 50 uS to leave ISC mode */
+
+       status = read_status(bank);
+       if (status.isc_mode) {
+               LOG_ERROR("*** XCF: FAILED to leave ISC mode");
+               return ERROR_FLASH_OPERATION_FAILED;
        }
+
+       return ERROR_OK;
 }
 
 static int sector_state(uint8_t wrpt, int sector)
diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c
index ad3bc6e37e..3a248e388f 100644
--- a/src/jtag/drivers/ulink.c
+++ b/src/jtag/drivers/ulink.c
@@ -606,7 +606,7 @@ static void ulink_clear_queue(struct ulink *device)
 
                /* IN payload MUST be freed ONLY if no other commands use the
                 * payload_in_start buffer */
-               if (current->free_payload_in_start == true) {
+               if (current->free_payload_in_start) {
                        free(current->payload_in_start);
                        current->payload_in_start = NULL;
                        current->payload_in = NULL;
@@ -1861,7 +1861,7 @@ static int ulink_post_process_queue(struct ulink *device)
 
                /* Check if a corresponding OpenOCD command is stored for this
                 * OpenULINK command */
-               if ((current->needs_postprocessing == true) && (openocd_cmd)) {
+               if (current->needs_postprocessing && openocd_cmd) {
                        switch (openocd_cmd->type) {
                            case JTAG_SCAN:
                                    ret = ulink_post_process_scan(current);
@@ -2131,7 +2131,7 @@ static int ulink_init(void)
                        download_firmware = true;
        }
 
-       if (download_firmware == true) {
+       if (download_firmware) {
                LOG_INFO("Loading OpenULINK firmware. This is reversible by 
power-cycling"
                        " ULINK device.");
                ret = ulink_load_firmware_and_renumerate(&ulink_handle,
diff --git a/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c 
b/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c
index de0d2d8472..1c845a8ee0 100644
--- a/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c
+++ b/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c
@@ -215,7 +215,7 @@ static int ublast2_libusb_init(struct ublast_lowlevel *low)
        const uint16_t vids_renum[] = { low->ublast_vid, 0 };
        const uint16_t pids_renum[] = { low->ublast_pid, 0 };
 
-       if (renumeration == false) {
+       if (!renumeration) {
                if (jtag_libusb_open(vids_renum, pids_renum, NULL, 
&low->libusb_dev, NULL) != ERROR_OK) {
                        LOG_ERROR("Altera USB-Blaster II not found");
                        return ERROR_FAIL;
diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c
index 4fe8419025..bf927e71a1 100644
--- a/src/rtos/hwthread.c
+++ b/src/rtos/hwthread.c
@@ -254,7 +254,7 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, 
int64_t thread_id,
 
        int j = 0;
        for (int i = 0; i < reg_list_size; i++) {
-               if (!reg_list[i] || reg_list[i]->exist == false || 
reg_list[i]->hidden)
+               if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
                        continue;
                j++;
        }
@@ -267,7 +267,7 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, 
int64_t thread_id,
 
        j = 0;
        for (int i = 0; i < reg_list_size; i++) {
-               if (!reg_list[i] || reg_list[i]->exist == false || 
reg_list[i]->hidden)
+               if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
                        continue;
                if (!reg_list[i]->valid) {
                        retval = reg_list[i]->type->get(reg_list[i]);
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 0df1182c0a..54e31e4268 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -389,7 +389,7 @@ int rtos_thread_packet(struct connection *connection, char 
const *packet, int pa
                return ERROR_OK;
        } else if (strncmp(packet, "qSymbol", 7) == 0) {
                if (rtos_qsymbol(connection, packet, packet_size) == 1) {
-                       if (target->rtos_auto_detect == true) {
+                       if (target->rtos_auto_detect) {
                                target->rtos_auto_detect = false;
                                target->rtos->type->create(target);
                        }
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 2db3123a04..9171537e4d 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -1262,7 +1262,7 @@ static int gdb_get_registers_packet(struct connection 
*connection,
                return gdb_error(connection, retval);
 
        for (i = 0; i < reg_list_size; i++) {
-               if (!reg_list[i] || reg_list[i]->exist == false || 
reg_list[i]->hidden)
+               if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
                        continue;
                reg_packet_size += DIV_ROUND_UP(reg_list[i]->size, 8) * 2;
        }
@@ -1276,7 +1276,7 @@ static int gdb_get_registers_packet(struct connection 
*connection,
        reg_packet_p = reg_packet;
 
        for (i = 0; i < reg_list_size; i++) {
-               if (!reg_list[i] || reg_list[i]->exist == false || 
reg_list[i]->hidden)
+               if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
                        continue;
                retval = gdb_get_reg_value_as_str(target, reg_packet_p, 
reg_list[i]);
                if (retval != ERROR_OK && gdb_report_register_access_error) {
@@ -2263,7 +2263,7 @@ static int get_reg_features_list(struct target *target, 
char const **feature_lis
        *feature_list = calloc(1, sizeof(char *));
 
        for (int i = 0; i < reg_list_size; i++) {
-               if (reg_list[i]->exist == false || reg_list[i]->hidden)
+               if (!reg_list[i]->exist || reg_list[i]->hidden)
                        continue;
 
                if (reg_list[i]->feature
@@ -2473,7 +2473,7 @@ static int gdb_generate_target_description(struct target 
*target, char **tdesc_o
                        int i;
                        for (i = 0; i < reg_list_size; i++) {
 
-                               if (reg_list[i]->exist == false || 
reg_list[i]->hidden)
+                               if (!reg_list[i]->exist || reg_list[i]->hidden)
                                        continue;
 
                                if (strcmp(reg_list[i]->feature->name, 
features[current_feature]))
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index 3b95b648ef..cf311a3a41 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -1521,7 +1521,7 @@ static int cortex_m_step(struct target *target, int 
current,
        /* if no bkpt instruction is found at pc then we can perform
         * a normal step, otherwise we have to manually step over the bkpt
         * instruction - as such simulate a step */
-       if (bkpt_inst_found == false) {
+       if (!bkpt_inst_found) {
                if (cortex_m->isrmasking_mode != CORTEX_M_ISRMASK_AUTO) {
                        /* Automatic ISR masking mode off: Just step over the 
next
                         * instruction, with interrupts on or off as 
appropriate. */
diff --git a/src/target/target.c b/src/target/target.c
index f7fdc93bad..63fe99ac94 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3042,7 +3042,7 @@ COMMAND_HANDLER(handle_reg_command)
                        for (i = 0, reg = cache->reg_list;
                                        i < cache->num_regs;
                                        i++, reg++, count++) {
-                               if (reg->exist == false || reg->hidden)
+                               if (!reg->exist || reg->hidden)
                                        continue;
                                /* only print cached values if they are valid */
                                if (reg->valid) {

-- 

Reply via email to