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.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8496
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2024-09-16 11:55:20 +02:00
parent 66006d83b9
commit 3ccf68cd0a
9 changed files with 44 additions and 46 deletions

View File

@@ -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);

View File

@@ -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;
struct scan_field scan;
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
jtag_execute_queue();
alive_sleep(1); /* device needs 50 uS to leave ISC mode */
scan.check_mask = NULL;
scan.check_value = NULL;
scan.num_bits = 16;
scan.out_value = cmd_isc_disable;
scan.in_value = NULL;
status = read_status(bank);
if (status.isc_mode) {
LOG_ERROR("*** XCF: FAILED to leave ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
}
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
jtag_execute_queue();
alive_sleep(1); /* device needs 50 uS to leave ISC mode */
return ERROR_OK;
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)