aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/flash/nand/fileio.c4
-rw-r--r--src/flash/nor/avrf.c16
-rw-r--r--src/flash/nor/cc26xx.c8
-rw-r--r--src/flash/nor/cc3220sf.c14
-rw-r--r--src/flash/nor/efm32.c6
-rw-r--r--src/flash/nor/fespi.c6
-rw-r--r--src/flash/nor/msp432.c26
-rw-r--r--src/flash/nor/tms470.c2
-rw-r--r--src/helper/binarybuffer.c2
-rw-r--r--src/helper/jim-nvp.c4
-rw-r--r--src/helper/replacements.c2
-rw-r--r--src/helper/time_support.c2
-rw-r--r--src/jtag/aice/aice_interface.c4
-rw-r--r--src/jtag/aice/aice_usb.c96
-rw-r--r--src/jtag/core.c4
-rw-r--r--src/jtag/drivers/buspirate.c10
-rw-r--r--src/jtag/drivers/cmsis_dap_usb_hid.c2
-rw-r--r--src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c50
-rw-r--r--src/jtag/drivers/versaloon/versaloon.c10
-rw-r--r--src/jtag/drivers/vsllink.c6
-rw-r--r--src/jtag/drivers/xds110.c32
-rw-r--r--src/rtos/embKernel.c2
-rw-r--r--src/rtos/mqx.c6
-rw-r--r--src/rtos/riot.c2
-rw-r--r--src/rtos/rtos.c2
-rw-r--r--src/server/gdb_server.c6
-rw-r--r--src/svf/svf.c34
-rw-r--r--src/target/armv8.c2
-rw-r--r--src/target/lakemont.c4
-rw-r--r--src/target/nds32.c56
-rw-r--r--src/target/nds32_cmd.c6
-rw-r--r--src/target/nds32_v2.c20
-rw-r--r--src/target/nds32_v3_common.c18
-rw-r--r--src/target/target.c2
34 files changed, 233 insertions, 233 deletions
diff --git a/src/flash/nand/fileio.c b/src/flash/nand/fileio.c
index 49db112..b9c7f79 100644
--- a/src/flash/nand/fileio.c
+++ b/src/flash/nand/fileio.c
@@ -119,7 +119,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
nand_fileio_init(state);
unsigned minargs = need_size ? 4 : 3;
- if (CMD_ARGC < minargs)
+ if (minargs > CMD_ARGC)
return ERROR_COMMAND_SYNTAX_ERROR;
struct nand_device *nand;
@@ -141,7 +141,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
}
}
- if (CMD_ARGC > minargs) {
+ if (minargs < CMD_ARGC) {
for (unsigned i = minargs; i < CMD_ARGC; i++) {
if (!strcmp(CMD_ARGV[i], "oob_raw"))
state->oob_format |= NAND_OOB_RAW;
diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c
index 4fa4e0d..a5a2cbd 100644
--- a/src/flash/nor/avrf.c
+++ b/src/flash/nor/avrf.c
@@ -134,7 +134,7 @@ static int avr_jtagprg_chiperase(struct avr_common *avr)
&poll_value,
0x3380,
AVR_JTAG_REG_PROGRAMMING_COMMAND_LEN);
- if (ERROR_OK != mcu_execute_queue())
+ if (mcu_execute_queue() != ERROR_OK)
return ERROR_FAIL;
LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value);
} while (!(poll_value & 0x0200));
@@ -195,7 +195,7 @@ static int avr_jtagprg_writeflashpage(struct avr_common *avr,
&poll_value,
0x3700,
AVR_JTAG_REG_PROGRAMMING_COMMAND_LEN);
- if (ERROR_OK != mcu_execute_queue())
+ if (mcu_execute_queue() != ERROR_OK)
return ERROR_FAIL;
LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value);
} while (!(poll_value & 0x0200));
@@ -266,7 +266,7 @@ static int avrf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t o
LOG_DEBUG("offset is 0x%08" PRIx32 "", offset);
LOG_DEBUG("count is %" PRIu32 "", count);
- if (ERROR_OK != avr_jtagprg_enterprogmode(avr))
+ if (avr_jtagprg_enterprogmode(avr) != ERROR_OK)
return ERROR_FAIL;
if (bank->size > 0x20000)
@@ -315,7 +315,7 @@ static int avrf_probe(struct flash_bank *bank)
avrf_info->probed = false;
avr_jtag_read_jtagid(avr, &device_id);
- if (ERROR_OK != mcu_execute_queue())
+ if (mcu_execute_queue() != ERROR_OK)
return ERROR_FAIL;
LOG_INFO("device id = 0x%08" PRIx32 "", device_id);
@@ -380,7 +380,7 @@ static int avrf_info(struct flash_bank *bank, struct command_invocation *cmd)
}
avr_jtag_read_jtagid(avr, &device_id);
- if (ERROR_OK != mcu_execute_queue())
+ if (mcu_execute_queue() != ERROR_OK)
return ERROR_FAIL;
LOG_INFO("device id = 0x%08" PRIx32 "", device_id);
@@ -420,9 +420,9 @@ static int avrf_mass_erase(struct flash_bank *bank)
return ERROR_TARGET_NOT_HALTED;
}
- if ((ERROR_OK != avr_jtagprg_enterprogmode(avr))
- || (ERROR_OK != avr_jtagprg_chiperase(avr))
- || (ERROR_OK != avr_jtagprg_leaveprogmode(avr)))
+ if ((avr_jtagprg_enterprogmode(avr) != ERROR_OK)
+ || (avr_jtagprg_chiperase(avr) != ERROR_OK)
+ || (avr_jtagprg_leaveprogmode(avr) != ERROR_OK))
return ERROR_FAIL;
return ERROR_OK;
diff --git a/src/flash/nor/cc26xx.c b/src/flash/nor/cc26xx.c
index 0895798..f6b5632 100644
--- a/src/flash/nor/cc26xx.c
+++ b/src/flash/nor/cc26xx.c
@@ -148,7 +148,7 @@ static int cc26xx_init(struct flash_bank *bank)
return retval;
/* Confirm the defined working address is the area we need to use */
- if (CC26XX_ALGO_BASE_ADDRESS != cc26xx_bank->working_area->address)
+ if (cc26xx_bank->working_area->address != CC26XX_ALGO_BASE_ADDRESS)
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
/* Write flash helper algorithm into target memory */
@@ -211,7 +211,7 @@ static int cc26xx_mass_erase(struct flash_bank *bank)
int retval;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -275,7 +275,7 @@ static int cc26xx_erase(struct flash_bank *bank, unsigned int first,
uint32_t length;
int retval;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -327,7 +327,7 @@ static int cc26xx_write(struct flash_bank *bank, const uint8_t *buffer,
uint32_t index;
int retval;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
diff --git a/src/flash/nor/cc3220sf.c b/src/flash/nor/cc3220sf.c
index 522b21a..b296538 100644
--- a/src/flash/nor/cc3220sf.c
+++ b/src/flash/nor/cc3220sf.c
@@ -42,7 +42,7 @@ static int cc3220sf_mass_erase(struct flash_bank *bank)
int retval = ERROR_OK;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -118,7 +118,7 @@ static int cc3220sf_erase(struct flash_bank *bank, unsigned int first,
int retval = ERROR_OK;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -192,7 +192,7 @@ static int cc3220sf_write(struct flash_bank *bank, const uint8_t *buffer,
int retval = ERROR_OK;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -295,7 +295,7 @@ static int cc3220sf_write(struct flash_bank *bank, const uint8_t *buffer,
/* Check that the head value was written to flash */
result = buf_get_u32(reg_params[2].value, 0, 32);
- if (0 != result) {
+ if (result != 0) {
retval = ERROR_FAIL;
LOG_ERROR("cc3220sf: Flash operation failed");
}
@@ -359,7 +359,7 @@ static int cc3220sf_write(struct flash_bank *bank, const uint8_t *buffer,
/* Check that all words were written to flash */
result = buf_get_u32(reg_params[2].value, 0, 32);
- if (0 != result) {
+ if (result != 0) {
retval = ERROR_FAIL;
LOG_ERROR("cc3220sf: Flash operation failed");
break;
@@ -369,7 +369,7 @@ static int cc3220sf_write(struct flash_bank *bank, const uint8_t *buffer,
}
/* Do one word write for any final bytes less than a full word */
- if ((retval == ERROR_OK) && (0 != tail_count)) {
+ if ((retval == ERROR_OK) && (tail_count != 0)) {
uint8_t tail[4];
/* Set starting byte offset for data to write */
@@ -409,7 +409,7 @@ static int cc3220sf_write(struct flash_bank *bank, const uint8_t *buffer,
/* Check that the tail was written to flash */
result = buf_get_u32(reg_params[2].value, 0, 32);
- if (0 != result) {
+ if (result != 0) {
retval = ERROR_FAIL;
LOG_ERROR("cc3220sf: Flash operation failed");
}
diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c
index c8ce908..ab0186d 100644
--- a/src/flash/nor/efm32.c
+++ b/src/flash/nor/efm32.c
@@ -386,7 +386,7 @@ static int efm32x_wait_status(struct flash_bank *bank, int timeout,
LOG_DEBUG("status: 0x%" PRIx32 "", status);
- if (((status & wait_mask) == 0) && (0 == wait_for_set))
+ if (((status & wait_mask) == 0) && (wait_for_set == 0))
break;
else if (((status & wait_mask) != 0) && wait_for_set)
break;
@@ -457,7 +457,7 @@ static int efm32x_erase(struct flash_bank *bank, unsigned int first,
struct target *target = bank->target;
int ret = 0;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -958,7 +958,7 @@ static int efm32x_probe(struct flash_bank *bank)
LOG_INFO("flash size = %dkbytes", efm32_mcu_info.flash_sz_kib);
LOG_INFO("flash page size = %dbytes", efm32_mcu_info.page_size);
- assert(0 != efm32_mcu_info.page_size);
+ assert(efm32_mcu_info.page_size != 0);
int num_pages = efm32_mcu_info.flash_sz_kib * 1024 /
efm32_mcu_info.page_size;
diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c
index 99ec67d..150e91a 100644
--- a/src/flash/nor/fespi.c
+++ b/src/flash/nor/fespi.c
@@ -538,7 +538,7 @@ static unsigned as_compile(struct algorithm_steps *as, uint8_t *target,
break;
}
case STEP_WRITE_REG:
- if (4 > bytes_left) {
+ if (bytes_left < 4) {
finish_early = true;
break;
}
@@ -546,7 +546,7 @@ static unsigned as_compile(struct algorithm_steps *as, uint8_t *target,
offset += 3;
break;
case STEP_SET_DIR:
- if (3 > bytes_left) {
+ if (bytes_left < 3) {
finish_early = true;
break;
}
@@ -555,7 +555,7 @@ static unsigned as_compile(struct algorithm_steps *as, uint8_t *target,
break;
case STEP_TXWM_WAIT:
case STEP_WIP_WAIT:
- if (2 > bytes_left) {
+ if (bytes_left < 2) {
finish_early = true;
break;
}
diff --git a/src/flash/nor/msp432.c b/src/flash/nor/msp432.c
index 23d4982..667349f 100644
--- a/src/flash/nor/msp432.c
+++ b/src/flash/nor/msp432.c
@@ -209,7 +209,7 @@ static int msp432_wait_return_code(struct target *target)
int retval = ERROR_OK;
start_ms = timeval_ms();
- while ((0 == return_code) || (return_code == FLASH_BUSY)) {
+ while ((return_code == 0) || (return_code == FLASH_BUSY)) {
retval = target_read_u32(target, ALGO_RETURN_CODE_ADDR, &return_code);
if (retval != ERROR_OK)
return retval;
@@ -322,11 +322,11 @@ static int msp432_init(struct flash_bank *bank)
"msp432: Unrecognized MSP432P4 Device ID and Hardware "
"Rev (%04" PRIX32 ", %02" PRIX32 ")", msp432_bank->device_id,
msp432_bank->hardware_rev);
- } else if (MSP432P401X_DEPR == msp432_bank->device_type) {
+ } else if (msp432_bank->device_type == MSP432P401X_DEPR) {
LOG_WARNING(
"msp432: MSP432P401x pre-production device (deprecated "
"silicon)\n" SUPPORT_MESSAGE);
- } else if (MSP432E4X_GUESS == msp432_bank->device_type) {
+ } else if (msp432_bank->device_type == MSP432E4X_GUESS) {
/* Explicit device type check failed. Report this. */
LOG_WARNING(
"msp432: Unrecognized MSP432E4 DID0 and DID1 values "
@@ -343,7 +343,7 @@ static int msp432_init(struct flash_bank *bank)
return retval;
/* Confirm the defined working address is the area we need to use */
- if (ALGO_BASE_ADDR != msp432_bank->working_area->address)
+ if (msp432_bank->working_area->address != ALGO_BASE_ADDR)
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
/* Write flash helper algorithm into target memory */
@@ -432,7 +432,7 @@ static int msp432_mass_erase(struct flash_bank *bank, bool all)
int retval;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -501,7 +501,7 @@ COMMAND_HANDLER(msp432_mass_erase_command)
msp432_bank = bank->driver_priv;
- if (MSP432E4 == msp432_bank->family_type) {
+ if (msp432_bank->family_type == MSP432E4) {
/* MSP432E4 does not have main vs info regions, ignore "all" */
all = false;
}
@@ -510,7 +510,7 @@ COMMAND_HANDLER(msp432_mass_erase_command)
if (retval != ERROR_OK)
return retval;
- if (MSP432E4 == msp432_bank->family_type) {
+ if (msp432_bank->family_type == MSP432E4) {
/* MSP432E4 does not have main vs info regions */
LOG_INFO("msp432: Mass erase of flash is complete");
} else {
@@ -537,7 +537,7 @@ COMMAND_HANDLER(msp432_bsl_command)
msp432_bank = bank->driver_priv;
- if (MSP432E4 == msp432_bank->family_type) {
+ if (msp432_bank->family_type == MSP432E4) {
LOG_WARNING("msp432: MSP432E4 does not have a BSL region");
return ERROR_OK;
}
@@ -602,7 +602,7 @@ static int msp432_erase(struct flash_bank *bank, unsigned int first,
int retval;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -680,7 +680,7 @@ static int msp432_write(struct flash_bank *bank, const uint8_t *buffer,
int retval;
- if (TARGET_HALTED != target->state) {
+ if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
@@ -829,7 +829,7 @@ static int msp432_probe(struct flash_bank *bank)
if (retval != ERROR_OK)
return retval;
- if (0 == size) {
+ if (size == 0) {
/* This is likely an MSP432E4 */
msp432_bank->family_type = MSP432E4;
@@ -864,7 +864,7 @@ static int msp432_probe(struct flash_bank *bank)
msp432_bank->device_type = msp432_device_type(msp432_bank->family_type,
msp432_bank->device_id, msp432_bank->hardware_rev);
- if (MSP432P4 == msp432_bank->family_type) {
+ if (msp432_bank->family_type == MSP432P4) {
/* Set up MSP432P4 specific flash parameters */
if (is_main) {
retval = target_read_u32(target, P4_FLASH_MAIN_SIZE_REG, &size);
@@ -981,7 +981,7 @@ static int msp432_info(struct flash_bank *bank, struct command_invocation *cmd)
switch (msp432_bank->device_type) {
case MSP432P401X_DEPR:
- if (0xFFFF == msp432_bank->device_id) {
+ if (msp432_bank->device_id == 0xFFFF) {
/* Very early pre-production silicon currently deprecated */
command_print_sameline(cmd, "MSP432P401x pre-production device (deprecated silicon)\n"
SUPPORT_MESSAGE);
diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c
index 5078314..37f0933 100644
--- a/src/flash/nor/tms470.c
+++ b/src/flash/nor/tms470.c
@@ -437,7 +437,7 @@ static int tms470_try_flash_keys(struct target *target, const uint32_t *key_set)
target_write_u32(target, 0xFFE89C0C, key_set[i]);
}
- if (ERROR_OK == tms470_check_flash_unlocked(target)) {
+ if (tms470_check_flash_unlocked(target) == ERROR_OK) {
/*
* There seems to be a side-effect of reading the FMPKEY
* register in that it re-enables the protection. So we
diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c
index 49e347b..e2dfa87 100644
--- a/src/helper/binarybuffer.c
+++ b/src/helper/binarybuffer.c
@@ -222,7 +222,7 @@ static void str_radix_guess(const char **_str, unsigned *_str_len,
unsigned *_radix)
{
unsigned radix = *_radix;
- if (0 != radix)
+ if (radix != 0)
return;
const char *str = *_str;
unsigned str_len = *_str_len;
diff --git a/src/helper/jim-nvp.c b/src/helper/jim-nvp.c
index 580b079..e21bc68 100644
--- a/src/helper/jim-nvp.c
+++ b/src/helper/jim-nvp.c
@@ -66,7 +66,7 @@ int jim_get_nvp(Jim_Interp *interp,
struct jim_nvp *jim_nvp_name2value_simple(const struct jim_nvp *p, const char *name)
{
while (p->name) {
- if (0 == strcmp(name, p->name))
+ if (strcmp(name, p->name) == 0)
break;
p++;
}
@@ -76,7 +76,7 @@ struct jim_nvp *jim_nvp_name2value_simple(const struct jim_nvp *p, const char *n
struct jim_nvp *jim_nvp_name2value_nocase_simple(const struct jim_nvp *p, const char *name)
{
while (p->name) {
- if (0 == strcasecmp(name, p->name))
+ if (strcasecmp(name, p->name) == 0)
break;
p++;
}
diff --git a/src/helper/replacements.c b/src/helper/replacements.c
index 86ddd80..81b1976 100644
--- a/src/helper/replacements.c
+++ b/src/helper/replacements.c
@@ -233,7 +233,7 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
if (retcode < 0)
retcode = 0;
for (i = 0; i < n_handles; i++) {
- if (WAIT_OBJECT_0 == WaitForSingleObject(handles[i], 0)) {
+ if (WaitForSingleObject(handles[i], 0) == WAIT_OBJECT_0) {
if (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) {
DWORD bytes;
intptr_t handle = (intptr_t) _get_osfhandle(
diff --git a/src/helper/time_support.c b/src/helper/time_support.c
index 05eaf0a..861889e 100644
--- a/src/helper/time_support.c
+++ b/src/helper/time_support.c
@@ -86,7 +86,7 @@ int duration_measure(struct duration *duration)
{
struct timeval end;
int retval = gettimeofday(&end, NULL);
- if (0 == retval)
+ if (retval == 0)
timeval_subtract(&duration->elapsed, &end, &duration->start);
return retval;
}
diff --git a/src/jtag/aice/aice_interface.c b/src/jtag/aice/aice_interface.c
index 86e9d16..c7556c0 100644
--- a/src/jtag/aice/aice_interface.c
+++ b/src/jtag/aice/aice_interface.c
@@ -121,7 +121,7 @@ int aice_init_targets(void)
*/
static int aice_init(void)
{
- if (ERROR_OK != aice_port->api->open(&param)) {
+ if (aice_port->api->open(&param) != ERROR_OK) {
LOG_ERROR("Cannot find AICE Interface! Please check "
"connection and permissions.");
return ERROR_JTAG_INIT_FAILED;
@@ -217,7 +217,7 @@ static int aice_khz(int khz, int *jtag_speed)
int i;
for (i = 0 ; i < AICE_KHZ_TO_SPEED_MAP_SIZE ; i++) {
if (khz == aice_khz_to_speed_map[i]) {
- if (8 <= i)
+ if (i >= 8)
*jtag_speed = i | AICE_TCK_CONTROL_TCK3048;
else
*jtag_speed = i;
diff --git a/src/jtag/aice/aice_usb.c b/src/jtag/aice/aice_usb.c
index 53d2838..8a8b830 100644
--- a/src/jtag/aice/aice_usb.c
+++ b/src/jtag/aice/aice_usb.c
@@ -1835,9 +1835,9 @@ static int aice_check_dbger(uint32_t coreid, uint32_t expect_status)
aice_read_misc(coreid, NDS_EDM_MISC_DBGER, &value_dbger);
if ((value_dbger & expect_status) == expect_status) {
- if (ERROR_OK != check_suppressed_exception(coreid, value_dbger))
+ if (check_suppressed_exception(coreid, value_dbger) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != check_privilege(coreid, value_dbger))
+ if (check_privilege(coreid, value_dbger) != ERROR_OK)
return ERROR_FAIL;
return ERROR_OK;
}
@@ -1895,18 +1895,18 @@ static int aice_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
uint32_t instructions[4]; /** execute instructions in DIM */
- if (NDS32_REG_TYPE_GPR == nds32_reg_type(num)) { /* general registers */
+ if (nds32_reg_type(num) == NDS32_REG_TYPE_GPR) { /* general registers */
instructions[0] = MTSR_DTR(num);
instructions[1] = DSB;
instructions[2] = NOP;
instructions[3] = BEQ_MINUS_12;
- } else if (NDS32_REG_TYPE_SPR == nds32_reg_type(num)) { /* user special registers */
+ } else if (nds32_reg_type(num) == NDS32_REG_TYPE_SPR) { /* user special registers */
instructions[0] = MFUSR_G0(0, nds32_reg_sr_index(num));
instructions[1] = MTSR_DTR(0);
instructions[2] = DSB;
instructions[3] = BEQ_MINUS_12;
- } else if (NDS32_REG_TYPE_AUMR == nds32_reg_type(num)) { /* audio registers */
- if ((CB_CTL <= num) && (num <= CBE3)) {
+ } else if (nds32_reg_type(num) == NDS32_REG_TYPE_AUMR) { /* audio registers */
+ if ((num >= CB_CTL) && (num <= CBE3)) {
instructions[0] = AMFAR2(0, nds32_reg_sr_index(num));
instructions[1] = MTSR_DTR(0);
instructions[2] = DSB;
@@ -1917,7 +1917,7 @@ static int aice_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
instructions[2] = DSB;
instructions[3] = BEQ_MINUS_12;
}
- } else if (NDS32_REG_TYPE_FPU == nds32_reg_type(num)) { /* fpu registers */
+ } else if (nds32_reg_type(num) == NDS32_REG_TYPE_FPU) { /* fpu registers */
if (num == FPCSR) {
instructions[0] = FMFCSR;
instructions[1] = MTSR_DTR(0);
@@ -1983,7 +1983,7 @@ static int aice_usb_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
} else if ((core_info[coreid].target_dtr_valid == true) && (num == DR43)) {
*val = core_info[coreid].target_dtr_backup;
} else {
- if (ERROR_OK != aice_read_reg(coreid, num, val))
+ if (aice_read_reg(coreid, num, val) != ERROR_OK)
*val = 0xBBADBEEF;
}
@@ -2004,18 +2004,18 @@ static int aice_write_reg(uint32_t coreid, uint32_t num, uint32_t val)
return ERROR_FAIL;
}
- if (NDS32_REG_TYPE_GPR == nds32_reg_type(num)) { /* general registers */
+ if (nds32_reg_type(num) == NDS32_REG_TYPE_GPR) { /* general registers */
instructions[0] = MFSR_DTR(num);
instructions[1] = DSB;
instructions[2] = NOP;
instructions[3] = BEQ_MINUS_12;
- } else if (NDS32_REG_TYPE_SPR == nds32_reg_type(num)) { /* user special registers */
+ } else if (nds32_reg_type(num) == NDS32_REG_TYPE_SPR) { /* user special registers */
instructions[0] = MFSR_DTR(0);
instructions[1] = MTUSR_G0(0, nds32_reg_sr_index(num));
instructions[2] = DSB;
instructions[3] = BEQ_MINUS_12;
- } else if (NDS32_REG_TYPE_AUMR == nds32_reg_type(num)) { /* audio registers */
- if ((CB_CTL <= num) && (num <= CBE3)) {
+ } else if (nds32_reg_type(num) == NDS32_REG_TYPE_AUMR) { /* audio registers */
+ if ((num >= CB_CTL) && (num <= CBE3)) {
instructions[0] = MFSR_DTR(0);
instructions[1] = AMTAR2(0, nds32_reg_sr_index(num));
instructions[2] = DSB;
@@ -2026,7 +2026,7 @@ static int aice_write_reg(uint32_t coreid, uint32_t num, uint32_t val)
instructions[2] = DSB;
instructions[3] = BEQ_MINUS_12;
}
- } else if (NDS32_REG_TYPE_FPU == nds32_reg_type(num)) { /* fpu registers */
+ } else if (nds32_reg_type(num) == NDS32_REG_TYPE_FPU) { /* fpu registers */
if (num == FPCSR) {
instructions[0] = MFSR_DTR(0);
instructions[1] = FMTCSR;
@@ -2146,7 +2146,7 @@ static int aice_usb_read_reg_64(uint32_t coreid, uint32_t num, uint64_t *val)
uint32_t value;
uint32_t high_value;
- if (ERROR_OK != aice_read_reg(coreid, num, &value))
+ if (aice_read_reg(coreid, num, &value) != ERROR_OK)
value = 0xBBADBEEF;
aice_read_reg(coreid, R1, &high_value);
@@ -2503,10 +2503,10 @@ static int aice_restore_tmp_registers(uint32_t coreid)
static int aice_open_device(struct aice_port_param_s *param)
{
- if (ERROR_OK != aice_usb_open(param))
+ if (aice_usb_open(param) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_FAIL == aice_get_version_info()) {
+ if (aice_get_version_info() == ERROR_FAIL) {
LOG_ERROR("Cannot get AICE version!");
return ERROR_FAIL;
}
@@ -2514,7 +2514,7 @@ static int aice_open_device(struct aice_port_param_s *param)
LOG_INFO("AICE initialization started");
/* attempt to reset Andes EDM */
- if (ERROR_FAIL == aice_reset_box()) {
+ if (aice_reset_box() == ERROR_FAIL) {
LOG_ERROR("Cannot initial AICE box!");
return ERROR_FAIL;
}
@@ -2526,7 +2526,7 @@ static int aice_usb_set_jtag_clock(uint32_t a_clock)
{
jtag_clock = a_clock;
- if (ERROR_OK != aice_usb_set_clock(a_clock)) {
+ if (aice_usb_set_clock(a_clock) != ERROR_OK) {
LOG_ERROR("Cannot set AICE JTAG clock!");
return ERROR_FAIL;
}
@@ -2705,7 +2705,7 @@ static int aice_usb_state(uint32_t coreid, enum aice_target_state_s *state)
/* Clear CRST */
aice_write_misc(coreid, NDS_EDM_MISC_DBGER, NDS_DBGER_CRST);
} else if ((dbger_value & NDS_DBGER_DEX) == NDS_DBGER_DEX) {
- if (AICE_TARGET_RUNNING == core_info[coreid].core_state) {
+ if (core_info[coreid].core_state == AICE_TARGET_RUNNING) {
/* enter debug mode, init EDM registers */
/* backup EDM registers */
aice_backup_edm_registers(coreid);
@@ -2713,7 +2713,7 @@ static int aice_usb_state(uint32_t coreid, enum aice_target_state_s *state)
aice_init_edm_registers(coreid, true);
aice_backup_tmp_registers(coreid);
core_info[coreid].core_state = AICE_TARGET_HALTED;
- } else if (AICE_TARGET_UNKNOWN == core_info[coreid].core_state) {
+ } else if (core_info[coreid].core_state == AICE_TARGET_UNKNOWN) {
/* debug 'debug mode', use force debug to halt core */
aice_usb_halt(coreid);
}
@@ -2889,7 +2889,7 @@ static int aice_usb_assert_srst(uint32_t coreid, enum aice_srst_type_s srst)
if (srst == AICE_SRST)
result = aice_issue_srst(coreid);
else {
- if (1 == total_num_of_core)
+ if (total_num_of_core == 1)
result = aice_issue_reset_hold(coreid);
else
result = aice_issue_reset_hold_multi();
@@ -2972,7 +2972,7 @@ static int aice_usb_step(uint32_t coreid)
aice_write_reg(coreid, ir0_reg_num, ir0_value);
}
- if (ERROR_FAIL == aice_usb_run(coreid))
+ if (aice_usb_run(coreid) == ERROR_FAIL)
return ERROR_FAIL;
int i = 0;
@@ -3092,7 +3092,7 @@ static int aice_usb_read_memory_unit(uint32_t coreid, uint32_t addr, uint32_t si
", size: %" PRIu32 ", count: %" PRIu32 "",
addr, size, count);
- if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_CPU)
aice_usb_set_address_dim(coreid, addr);
uint32_t value;
@@ -3101,7 +3101,7 @@ static int aice_usb_read_memory_unit(uint32_t coreid, uint32_t addr, uint32_t si
switch (size) {
case 1:
- if (NDS_MEMORY_ACC_BUS == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_BUS)
read_mem_func = aice_usb_read_mem_b_bus;
else
read_mem_func = aice_usb_read_mem_b_dim;
@@ -3113,7 +3113,7 @@ static int aice_usb_read_memory_unit(uint32_t coreid, uint32_t addr, uint32_t si
}
break;
case 2:
- if (NDS_MEMORY_ACC_BUS == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_BUS)
read_mem_func = aice_usb_read_mem_h_bus;
else
read_mem_func = aice_usb_read_mem_h_dim;
@@ -3127,7 +3127,7 @@ static int aice_usb_read_memory_unit(uint32_t coreid, uint32_t addr, uint32_t si
}
break;
case 4:
- if (NDS_MEMORY_ACC_BUS == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_BUS)
read_mem_func = aice_usb_read_mem_w_bus;
else
read_mem_func = aice_usb_read_mem_w_dim;
@@ -3211,7 +3211,7 @@ static int aice_usb_write_memory_unit(uint32_t coreid, uint32_t addr, uint32_t s
", size: %" PRIu32 ", count: %" PRIu32 "",
addr, size, count);
- if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_CPU)
aice_usb_set_address_dim(coreid, addr);
size_t i;
@@ -3219,7 +3219,7 @@ static int aice_usb_write_memory_unit(uint32_t coreid, uint32_t addr, uint32_t s
switch (size) {
case 1:
- if (NDS_MEMORY_ACC_BUS == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_BUS)
write_mem_func = aice_usb_write_mem_b_bus;
else
write_mem_func = aice_usb_write_mem_b_dim;
@@ -3231,7 +3231,7 @@ static int aice_usb_write_memory_unit(uint32_t coreid, uint32_t addr, uint32_t s
}
break;
case 2:
- if (NDS_MEMORY_ACC_BUS == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_BUS)
write_mem_func = aice_usb_write_mem_h_bus;
else
write_mem_func = aice_usb_write_mem_h_dim;
@@ -3246,7 +3246,7 @@ static int aice_usb_write_memory_unit(uint32_t coreid, uint32_t addr, uint32_t s
}
break;
case 4:
- if (NDS_MEMORY_ACC_BUS == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_BUS)
write_mem_func = aice_usb_write_mem_w_bus;
else
write_mem_func = aice_usb_write_mem_w_dim;
@@ -3322,10 +3322,10 @@ static int aice_usb_bulk_read_mem(uint32_t coreid, uint32_t addr,
int retval;
- if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_CPU)
aice_usb_set_address_dim(coreid, addr);
- if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_CPU)
retval = aice_usb_read_memory_unit(coreid, addr, 4, length / 4, buffer);
else
retval = aice_bulk_read_mem(coreid, addr, length / 4, buffer);
@@ -3340,10 +3340,10 @@ static int aice_usb_bulk_write_mem(uint32_t coreid, uint32_t addr,
int retval;
- if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_CPU)
aice_usb_set_address_dim(coreid, addr);
- if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
+ if (core_info[coreid].access_channel == NDS_MEMORY_ACC_CPU)
retval = aice_usb_write_memory_unit(coreid, addr, 4, length / 4, buffer);
else
retval = aice_bulk_write_mem(coreid, addr, length / 4, buffer);
@@ -3353,7 +3353,7 @@ static int aice_usb_bulk_write_mem(uint32_t coreid, uint32_t addr,
static int aice_usb_read_debug_reg(uint32_t coreid, uint32_t addr, uint32_t *val)
{
- if (AICE_TARGET_HALTED == core_info[coreid].core_state) {
+ if (core_info[coreid].core_state == AICE_TARGET_HALTED) {
if (addr == NDS_EDM_SR_EDMSW) {
*val = core_info[coreid].edmsw_backup;
} else if (addr == NDS_EDM_SR_EDM_DTR) {
@@ -3373,7 +3373,7 @@ static int aice_usb_read_debug_reg(uint32_t coreid, uint32_t addr, uint32_t *val
static int aice_usb_write_debug_reg(uint32_t coreid, uint32_t addr, const uint32_t val)
{
- if (AICE_TARGET_HALTED == core_info[coreid].core_state) {
+ if (core_info[coreid].core_state == AICE_TARGET_HALTED) {
if (addr == NDS_EDM_SR_EDM_DTR) {
core_info[coreid].host_dtr_backup = val;
core_info[coreid].edmsw_backup |= 0x2;
@@ -3402,7 +3402,7 @@ static int aice_usb_memory_mode(uint32_t coreid, enum nds_memory_select mem_sele
core_info[coreid].memory_select = mem_select;
- if (NDS_MEMORY_SELECT_AUTO != core_info[coreid].memory_select)
+ if (core_info[coreid].memory_select != NDS_MEMORY_SELECT_AUTO)
aice_write_misc(coreid, NDS_EDM_MISC_ACC_CTL,
core_info[coreid].memory_select - 1);
else
@@ -3454,13 +3454,13 @@ static int aice_usb_read_tlb(uint32_t coreid, target_addr_t virtual_address,
aice_read_reg(coreid, MR4, &value_mr4);
access_page_size = value_mr4 & 0xF;
- if (0 == access_page_size) { /* 4K page */
+ if (access_page_size == 0) { /* 4K page */
virtual_offset = virtual_address & 0x00000FFF;
physical_page_number = value_mr3 & 0xFFFFF000;
- } else if (1 == access_page_size) { /* 8K page */
+ } else if (access_page_size == 1) { /* 8K page */
virtual_offset = virtual_address & 0x00001FFF;
physical_page_number = value_mr3 & 0xFFFFE000;
- } else if (5 == access_page_size) { /* 1M page */
+ } else if (access_page_size == 5) { /* 1M page */
virtual_offset = virtual_address & 0x000FFFFF;
physical_page_number = value_mr3 & 0xFFF00000;
} else {
@@ -3546,10 +3546,10 @@ static int aice_usb_dcache_inval_all(uint32_t coreid)
cache_index = (way_index << (dcache->log2_set + dcache->log2_line_size)) |
(set_index << dcache->log2_line_size);
- if (ERROR_OK != aice_write_dtr(coreid, cache_index))
+ if (aice_write_dtr(coreid, cache_index) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != aice_execute_dim(coreid, instructions, 4))
+ if (aice_execute_dim(coreid, instructions, 4) != ERROR_OK)
return ERROR_FAIL;
}
}
@@ -3594,10 +3594,10 @@ static int aice_usb_dcache_wb_all(uint32_t coreid)
cache_index = (way_index << (dcache->log2_set + dcache->log2_line_size)) |
(set_index << dcache->log2_line_size);
- if (ERROR_OK != aice_write_dtr(coreid, cache_index))
+ if (aice_write_dtr(coreid, cache_index) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != aice_execute_dim(coreid, instructions, 4))
+ if (aice_execute_dim(coreid, instructions, 4) != ERROR_OK)
return ERROR_FAIL;
}
}
@@ -3642,10 +3642,10 @@ static int aice_usb_icache_inval_all(uint32_t coreid)
cache_index = (way_index << (icache->log2_set + icache->log2_line_size)) |
(set_index << icache->log2_line_size);
- if (ERROR_OK != aice_write_dtr(coreid, cache_index))
+ if (aice_write_dtr(coreid, cache_index) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != aice_execute_dim(coreid, instructions, 4))
+ if (aice_execute_dim(coreid, instructions, 4) != ERROR_OK)
return ERROR_FAIL;
}
}
@@ -3896,13 +3896,13 @@ static int fill_profiling_batch_commands(uint32_t coreid, uint32_t reg_no)
aice_read_dtr_to_buffer(coreid, AICE_BATCH_DATA_BUFFER_0);
/* get samples */
- if (NDS32_REG_TYPE_GPR == nds32_reg_type(reg_no)) {
+ if (nds32_reg_type(reg_no) == NDS32_REG_TYPE_GPR) {
/* general registers */
dim_instructions[0] = MTSR_DTR(reg_no);
dim_instructions[1] = DSB;
dim_instructions[2] = NOP;
dim_instructions[3] = BEQ_MINUS_12;
- } else if (NDS32_REG_TYPE_SPR == nds32_reg_type(reg_no)) {
+ } else if (nds32_reg_type(reg_no) == NDS32_REG_TYPE_SPR) {
/* user special registers */
dim_instructions[0] = MFUSR_G0(0, nds32_reg_sr_index(reg_no));
dim_instructions[1] = MTSR_DTR(0);
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 1406238..13366e0 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -243,7 +243,7 @@ struct jtag_tap *jtag_tap_by_string(const char *s)
struct jtag_tap *t = jtag_all_taps();
while (t) {
- if (0 == strcmp(t->dotted_name, s))
+ if (strcmp(t->dotted_name, s) == 0)
return t;
t = t->next_tap;
}
@@ -1197,7 +1197,7 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap)
return true;
/* treat "-expected-id 0" as a "don't-warn" wildcard */
- if (0 == tap->expected_ids[ii])
+ if (tap->expected_ids[ii] == 0)
return true;
}
diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c
index 642ad12..0864c60 100644
--- a/src/jtag/drivers/buspirate.c
+++ b/src/jtag/drivers/buspirate.c
@@ -800,7 +800,7 @@ static void buspirate_tap_append(int tms, int tdi)
int bit_index = tap_chain_index % 8;
uint8_t bit = 1 << bit_index;
- if (0 == bit_index) {
+ if (bit_index == 0) {
/* Let's say that the TAP shift operation wants to shift 9 bits,
so we will be sending to the Bus Pirate a bit count of 9 but still
full 16 bits (2 bytes) of shift data.
@@ -1178,13 +1178,13 @@ static int buspirate_serial_setspeed(int fd, char speed, cc_t timeout)
/* set the serial port parameters */
fcntl(fd, F_SETFL, 0);
- if (0 != tcgetattr(fd, &t_opt))
+ if (tcgetattr(fd, &t_opt) != 0)
return -1;
- if (0 != cfsetispeed(&t_opt, baud))
+ if (cfsetispeed(&t_opt, baud) != 0)
return -1;
- if (0 != cfsetospeed(&t_opt, baud))
+ if (cfsetospeed(&t_opt, baud) != 0)
return -1;
t_opt.c_cflag |= (CLOCAL | CREAD);
@@ -1206,7 +1206,7 @@ static int buspirate_serial_setspeed(int fd, char speed, cc_t timeout)
/* Note that, in the past, TCSANOW was used below instead of TCSADRAIN,
and CMD_UART_SPEED did not work properly then, at least with
the Bus Pirate v3.5 (USB). */
- if (0 != tcsetattr(fd, TCSADRAIN, &t_opt)) {
+ if (tcsetattr(fd, TCSADRAIN, &t_opt) != 0) {
/* According to the Linux documentation, this is actually not enough
to detect errors, you need to call tcgetattr() and check that
all changes have been performed successfully. */
diff --git a/src/jtag/drivers/cmsis_dap_usb_hid.c b/src/jtag/drivers/cmsis_dap_usb_hid.c
index ff0ac78..5bb8ee8 100644
--- a/src/jtag/drivers/cmsis_dap_usb_hid.c
+++ b/src/jtag/drivers/cmsis_dap_usb_hid.c
@@ -73,7 +73,7 @@ static int cmsis_dap_hid_open(struct cmsis_dap *dap, uint16_t vids[], uint16_t p
while (cur_dev) {
bool found = false;
- if (0 == vids[0]) {
+ if (vids[0] == 0) {
if (!cur_dev->product_string) {
LOG_DEBUG("Cannot read product string of device 0x%x:0x%x",
cur_dev->vendor_id, cur_dev->product_id);
diff --git a/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c b/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c
index fecd32c..f701bb0 100644
--- a/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c
+++ b/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c
@@ -126,12 +126,12 @@ RESULT usbtoxxx_execute_command(void)
return ERROR_FAIL;
}
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
versaloon_free_want_pos();
return ERRCODE_FAILURE_OPERATION;
}
- if (3 == usbtoxxx_buffer_index) {
+ if (usbtoxxx_buffer_index == 3) {
versaloon_free_want_pos();
return ERROR_OK;
}
@@ -139,7 +139,7 @@ RESULT usbtoxxx_execute_command(void)
versaloon_buf[0] = USB_TO_ALL;
SET_LE_U16(&versaloon_buf[1], usbtoxxx_buffer_index);
- if (ERROR_OK != versaloon_send_command(usbtoxxx_buffer_index, &inlen)) {
+ if (versaloon_send_command(usbtoxxx_buffer_index, &inlen) != ERROR_OK) {
versaloon_free_want_pos();
return ERROR_FAIL;
}
@@ -148,7 +148,7 @@ RESULT usbtoxxx_execute_command(void)
usbtoxxx_buffer_index = 0;
for (i = 0; i < versaloon_pending_idx; i++) {
/* check result */
- if ((0 == i) || !((versaloon_pending[i].collect)
+ if ((i == 0) || !((versaloon_pending[i].collect)
&& (versaloon_pending[i - 1].collect)
&& (versaloon_pending[i].cmd
== versaloon_pending[i - 1].cmd))) {
@@ -159,7 +159,7 @@ RESULT usbtoxxx_execute_command(void)
"current dongle");
result = ERROR_FAIL;
break;
- } else if (USB_TO_XXX_OK != versaloon_buf[usbtoxxx_buffer_index]) {
+ } else if (versaloon_buf[usbtoxxx_buffer_index] != USB_TO_XXX_OK) {
LOG_ERROR("%s command 0x%02x failed with 0x%02x",
usbtoxxx_get_type_name(versaloon_pending[i].type),
versaloon_pending[i].cmd,
@@ -245,8 +245,8 @@ RESULT usbtoxxx_init(void)
{
versaloon_pending_idx = 0;
- if ((ERROR_OK != usbtoinfo_get_abilities(usbtoxxx_abilities)) ||
- (ERROR_OK != usbtoxxx_execute_command()))
+ if ((usbtoinfo_get_abilities(usbtoxxx_abilities) != ERROR_OK) ||
+ (usbtoxxx_execute_command() != ERROR_OK))
return ERROR_FAIL;
LOG_INFO("USB_TO_XXX abilities: 0x%08X:0x%08X:0x%08X",
GET_LE_U32(&usbtoxxx_abilities[0]),
@@ -283,7 +283,7 @@ static RESULT usbtoxxx_ensure_buffer_size(uint16_t cmdlen)
memset(&context_tmp, 0, sizeof(context_tmp));
if (poll_nesting) {
- if (0 == poll_context.type_pre) {
+ if (poll_context.type_pre == 0) {
LOG_BUG("USB_TO_POLL toooooo long");
return ERROR_OK;
}
@@ -329,18 +329,18 @@ RESULT usbtoxxx_add_command(uint8_t type, uint8_t cmd, uint8_t *cmdbuf,
/* 3 more bytes by usbtoxxx_validate_current_command_type */
/* 3 more bytes when ((0 == collect_index) || (collect_cmd != cmd)) */
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(cmdlen + 6))
+ if (usbtoxxx_ensure_buffer_size(cmdlen + 6) != ERROR_OK)
return ERROR_FAIL;
if ((type_pre != type) || (!usbtoxxx_buffer)) {
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
type_pre = type;
}
- if ((0 == collect_index) || (collect_cmd != cmd)) {
+ if ((collect_index == 0) || (collect_cmd != cmd)) {
usbtoxxx_buffer[usbtoxxx_current_cmd_index++] = cmd;
if (collect) {
@@ -368,10 +368,10 @@ RESULT usbtoxxx_add_command(uint8_t type, uint8_t cmd, uint8_t *cmdbuf,
RESULT usbtoinfo_get_abilities(uint8_t abilities[USB_TO_XXX_ABILITIES_LEN])
{
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3))
+ if (usbtoxxx_ensure_buffer_size(3) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
@@ -383,12 +383,12 @@ RESULT usbtoinfo_get_abilities(uint8_t abilities[USB_TO_XXX_ABILITIES_LEN])
RESULT usbtopoll_start(uint16_t retry_cnt, uint16_t interval_us)
{
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3 + 5))
+ if (usbtoxxx_ensure_buffer_size(3 + 5) != ERROR_OK)
return ERROR_FAIL;
if (!poll_nesting)
usbtoxxx_save_context(&poll_context);
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
@@ -410,10 +410,10 @@ RESULT usbtopoll_end(void)
LOG_BUG(ERRMSG_FAILURE_OPERATION, "check poll nesting");
return ERRCODE_FAILURE_OPERATION;
}
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3 + 1))
+ if (usbtoxxx_ensure_buffer_size(3 + 1) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
@@ -439,10 +439,10 @@ RESULT usbtopoll_checkok(uint8_t equ, uint16_t offset, uint8_t size,
LOG_BUG(ERRMSG_FAILURE_OPERATION, "check poll nesting");
return ERRCODE_FAILURE_OPERATION;
}
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3 + 4 + 2 * size))
+ if (usbtoxxx_ensure_buffer_size(3 + 4 + 2 * size) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
@@ -475,10 +475,10 @@ RESULT usbtopoll_checkfail(uint8_t equ, uint16_t offset, uint8_t size,
LOG_BUG(ERRMSG_FAILURE_OPERATION, "check poll nesting");
return ERRCODE_FAILURE_OPERATION;
}
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3 + 4 + 2 * size))
+ if (usbtoxxx_ensure_buffer_size(3 + 4 + 2 * size) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
@@ -504,10 +504,10 @@ RESULT usbtopoll_verifybuff(uint16_t offset, uint16_t size, uint8_t *buff)
LOG_BUG(ERRMSG_FAILURE_OPERATION, "check poll nesting");
return ERRCODE_FAILURE_OPERATION;
}
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3 + 5 + size))
+ if (usbtoxxx_ensure_buffer_size(3 + 5 + size) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
@@ -527,10 +527,10 @@ RESULT usbtopoll_verifybuff(uint16_t offset, uint16_t size, uint8_t *buff)
RESULT usbtodelay_delay(uint16_t dly)
{
- if (ERROR_OK != usbtoxxx_ensure_buffer_size(3 + 2))
+ if (usbtoxxx_ensure_buffer_size(3 + 2) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != usbtoxxx_validate_current_command_type()) {
+ if (usbtoxxx_validate_current_command_type() != ERROR_OK) {
LOG_BUG(ERRMSG_FAILURE_OPERATION, "validate previous commands");
return ERRCODE_FAILURE_OPERATION;
}
diff --git a/src/jtag/drivers/versaloon/versaloon.c b/src/jtag/drivers/versaloon/versaloon.c
index 199c898..b17c1d4 100644
--- a/src/jtag/drivers/versaloon/versaloon.c
+++ b/src/jtag/drivers/versaloon/versaloon.c
@@ -203,7 +203,7 @@ RESULT versaloon_send_command(uint16_t out_len, uint16_t *inlen)
LOG_BUG(ERRMSG_INVALID_BUFFER, TO_STR(versaloon_buf));
return ERRCODE_INVALID_BUFFER;
}
- if ((0 == out_len) || (out_len > versaloon_interface.usb_setting.buf_size)) {
+ if ((out_len == 0) || (out_len > versaloon_interface.usb_setting.buf_size)) {
LOG_BUG(ERRMSG_INVALID_PARAMETER, __func__);
return ERRCODE_INVALID_PARAMETER;
}
@@ -222,7 +222,7 @@ RESULT versaloon_send_command(uint16_t out_len, uint16_t *inlen)
versaloon_interface.usb_setting.ep_in,
versaloon_buf, versaloon_interface.usb_setting.buf_size,
&transferred, versaloon_usb_to);
- if (0 == ret) {
+ if (ret == 0) {
*inlen = (uint16_t)transferred;
return ERROR_OK;
} else {
@@ -254,7 +254,7 @@ static RESULT versaloon_init(void)
versaloon_usb_to = 100;
for (retry = 0; retry < VERSALOON_RETRY_CNT; retry++) {
versaloon_buf[0] = VERSALOON_GET_INFO;
- if ((ERROR_OK == versaloon_send_command(1, &ret)) && (ret >= 3))
+ if ((versaloon_send_command(1, &ret) == ERROR_OK) && (ret >= 3))
break;
}
versaloon_usb_to = timeout_tmp;
@@ -285,7 +285,7 @@ static RESULT versaloon_init(void)
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
return ERRCODE_NOT_ENOUGH_MEMORY;
}
- if (ERROR_OK != usbtoxxx_init()) {
+ if (usbtoxxx_init() != ERROR_OK) {
LOG_ERROR(ERRMSG_FAILURE_OPERATION, "initialize usbtoxxx");
return ERROR_FAIL;
}
@@ -337,7 +337,7 @@ static RESULT versaloon_get_target_voltage(uint16_t *voltage)
versaloon_buf[0] = VERSALOON_GET_TVCC;
- if ((ERROR_OK != versaloon_send_command(1, &inlen)) || (inlen != 2)) {
+ if ((versaloon_send_command(1, &inlen) != ERROR_OK) || (inlen != 2)) {
LOG_ERROR(ERRMSG_FAILURE_OPERATION, "communicate with versaloon");
return ERRCODE_FAILURE_OPERATION;
} else {
diff --git a/src/jtag/drivers/vsllink.c b/src/jtag/drivers/vsllink.c
index d298a94..57a7c66 100644
--- a/src/jtag/drivers/vsllink.c
+++ b/src/jtag/drivers/vsllink.c
@@ -287,7 +287,7 @@ static int vsllink_interface_init(void)
libusb_init(&vsllink_handle->libusb_ctx);
- if (ERROR_OK != vsllink_usb_open(vsllink_handle)) {
+ if (vsllink_usb_open(vsllink_handle) != ERROR_OK) {
LOG_ERROR("Can't find USB JTAG Interface!"
"Please check connection and permissions.");
return ERROR_JTAG_INIT_FAILED;
@@ -297,7 +297,7 @@ static int vsllink_interface_init(void)
versaloon_interface.usb_setting.pid);
versaloon_usb_device_handle = vsllink_handle->usb_device_handle;
- if (ERROR_OK != versaloon_interface.init())
+ if (versaloon_interface.init() != ERROR_OK)
return ERROR_FAIL;
if (versaloon_interface.usb_setting.buf_size < 32) {
versaloon_interface.fini();
@@ -344,7 +344,7 @@ static int vsllink_init(void)
GPIO_TRST, GPIO_SRST, GPIO_SRST);
}
- if (ERROR_OK != versaloon_interface.adaptors.peripheral_commit())
+ if (versaloon_interface.adaptors.peripheral_commit() != ERROR_OK)
return ERROR_FAIL;
vsllink_reset(0, 0);
diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c
index f620514..243577d 100644
--- a/src/jtag/drivers/xds110.c
+++ b/src/jtag/drivers/xds110.c
@@ -341,7 +341,7 @@ static bool usb_connect(void)
/* Initialize libusb context */
result = libusb_init(&ctx);
- if (0 == result) {
+ if (result == 0) {
/* Get list of USB devices attached to system */
count = libusb_get_device_list(ctx, &list);
if (count <= 0) {
@@ -350,7 +350,7 @@ static bool usb_connect(void)
}
}
- if (0 == result) {
+ if (result == 0) {
/* Scan through list of devices for any XDS110s */
for (i = 0; i < count; i++) {
/* Check for device vid/pid match */
@@ -365,13 +365,13 @@ static bool usb_connect(void)
}
if (match) {
result = libusb_open(list[i], &dev);
- if (0 == result) {
+ if (result == 0) {
const int max_data = 256;
unsigned char data[max_data + 1];
*data = '\0';
/* May be the requested device if serial number matches */
- if (0 == xds110.serial[0]) {
+ if (xds110.serial[0] == 0) {
/* No serial number given; match first XDS110 found */
found = true;
break;
@@ -430,7 +430,7 @@ static bool usb_connect(void)
}
/* On an error, clean up what we can */
- if (0 != result) {
+ if (result != 0) {
if (dev) {
/* Release the debug and data interface on the XDS110 */
(void)libusb_release_interface(dev, xds110.interface);
@@ -443,12 +443,12 @@ static bool usb_connect(void)
}
/* Log the results */
- if (0 == result)
+ if (result == 0)
LOG_INFO("XDS110: connected");
else
LOG_ERROR("XDS110: failed to connect");
- return (0 == result) ? true : false;
+ return (result == 0) ? true : false;
}
static void usb_disconnect(void)
@@ -476,13 +476,13 @@ static bool usb_read(unsigned char *buffer, int size, int *bytes_read,
return false;
/* Force a non-zero timeout to prevent blocking */
- if (0 == timeout)
+ if (timeout == 0)
timeout = DEFAULT_TIMEOUT;
result = libusb_bulk_transfer(xds110.dev, xds110.endpoint_in, buffer, size,
bytes_read, timeout);
- return (0 == result) ? true : false;
+ return (result == 0) ? true : false;
}
static bool usb_write(unsigned char *buffer, int size, int *written)
@@ -671,7 +671,7 @@ static bool xds_execute(uint32_t out_length, uint32_t in_length,
if (!success)
error = SC_ERR_XDS110_FAIL;
- if (0 != error)
+ if (error != 0)
success = false;
return success;
@@ -1280,7 +1280,7 @@ static int xds110_swd_run_queue(void)
uint32_t value;
bool success = true;
- if (0 == xds110.txn_request_size)
+ if (xds110.txn_request_size == 0)
return ERROR_OK;
/* Terminate request queue */
@@ -1316,7 +1316,7 @@ static int xds110_swd_run_queue(void)
/* Transfer results into caller's buffers */
for (result = 0; result < xds110.txn_result_count; result++)
- if (0 != xds110.txn_dap_results[result])
+ if (xds110.txn_dap_results[result] != 0)
*xds110.txn_dap_results[result] = dap_results[result];
xds110.txn_request_size = 0;
@@ -1395,7 +1395,7 @@ static void xds110_show_info(void)
(((firmware >> 12) & 0xf) * 10) + ((firmware >> 8) & 0xf),
(((firmware >> 4) & 0xf) * 10) + ((firmware >> 0) & 0xf));
LOG_INFO("XDS110: hardware version = 0x%04x", xds110.hardware);
- if (0 != xds110.serial[0])
+ if (xds110.serial[0] != 0)
LOG_INFO("XDS110: serial number = %s", xds110.serial);
if (xds110.is_swd_mode) {
LOG_INFO("XDS110: connected to target via SWD");
@@ -1470,12 +1470,12 @@ static int xds110_init(void)
if (success) {
/* Set supply voltage for stand-alone probes */
- if (XDS110_STAND_ALONE_ID == xds110.hardware) {
+ if (xds110.hardware == XDS110_STAND_ALONE_ID) {
success = xds_set_supply(xds110.voltage);
/* Allow time for target device to power up */
/* (CC32xx takes up to 1300 ms before debug is enabled) */
alive_sleep(1500);
- } else if (0 != xds110.voltage) {
+ } else if (xds110.voltage != 0) {
/* Voltage supply not a feature of embedded probes */
LOG_WARNING(
"XDS110: ignoring supply voltage, not supported on this probe");
@@ -1557,7 +1557,7 @@ static void xds110_flush(void)
uint8_t data_in[MAX_DATA_BLOCK];
uint8_t *data_pntr;
- if (0 == xds110.txn_request_size)
+ if (xds110.txn_request_size == 0)
return;
/* Terminate request queue */
diff --git a/src/rtos/embKernel.c b/src/rtos/embKernel.c
index 85c8d19..d70ae37 100644
--- a/src/rtos/embKernel.c
+++ b/src/rtos/embKernel.c
@@ -121,7 +121,7 @@ static int embkernel_create(struct target *target)
{
size_t i = 0;
while ((i < ARRAY_SIZE(embkernel_params_list)) &&
- (0 != strcmp(embkernel_params_list[i].target_name, target->type->name)))
+ (strcmp(embkernel_params_list[i].target_name, target->type->name) != 0))
i++;
if (i >= ARRAY_SIZE(embkernel_params_list)) {
diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c
index 777d23c..754470e 100644
--- a/src/rtos/mqx.c
+++ b/src/rtos/mqx.c
@@ -260,7 +260,7 @@ static int mqx_create(
{
/* check target name against supported architectures */
for (unsigned int i = 0; i < ARRAY_SIZE(mqx_params_list); i++) {
- if (0 == strcmp(mqx_params_list[i].target_name, target->type->name)) {
+ if (strcmp(mqx_params_list[i].target_name, target->type->name) == 0) {
target->rtos->rtos_specific_params = (void *)&mqx_params_list[i];
/* LOG_DEBUG("MQX RTOS - valid architecture: %s", target->type->name); */
return 0;
@@ -291,7 +291,7 @@ static int mqx_update_threads(
/* clear old data */
rtos_free_threadlist(rtos);
/* check scheduler */
- if (ERROR_OK != mqx_is_scheduler_running(rtos))
+ if (mqx_is_scheduler_running(rtos) != ERROR_OK)
return ERROR_FAIL;
/* get kernel_data symbol */
if (mqx_get_symbol(rtos, MQX_VAL_MQX_KERNEL_DATA, &kernel_data_addr) != ERROR_OK)
@@ -438,7 +438,7 @@ static int mqx_get_thread_reg_list(
LOG_ERROR("MQX RTOS - invalid threadid: 0x%X", (int)thread_id);
return ERROR_FAIL;
}
- if (ERROR_OK != mqx_is_scheduler_running(rtos))
+ if (mqx_is_scheduler_running(rtos) != ERROR_OK)
return ERROR_FAIL;
/* get kernel_data symbol */
if (mqx_get_symbol(rtos, MQX_VAL_MQX_KERNEL_DATA, &kernel_data_addr) != ERROR_OK)
diff --git a/src/rtos/riot.c b/src/rtos/riot.c
index 6652db6..fb5d1b2 100644
--- a/src/rtos/riot.c
+++ b/src/rtos/riot.c
@@ -401,7 +401,7 @@ static int riot_create(struct target *target)
/* lookup if target is supported by RIOT */
while ((i < RIOT_NUM_PARAMS) &&
- (0 != strcmp(riot_params_list[i].target_name, target->type->name))) {
+ (strcmp(riot_params_list[i].target_name, target->type->name) != 0)) {
i++;
}
if (i >= RIOT_NUM_PARAMS) {
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 2b62154..c9c4efd 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -152,7 +152,7 @@ int rtos_create(struct jim_getopt_info *goi, struct target *target)
}
for (x = 0; rtos_types[x]; x++)
- if (0 == strcmp(cp, rtos_types[x]->name))
+ if (strcmp(cp, rtos_types[x]->name) == 0)
return os_alloc_create(target, rtos_types[x]);
Jim_SetResultFormatted(goi->interp, "Unknown RTOS type %s, try one of: ", cp);
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 3a39f8a..015baa1 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -1212,7 +1212,7 @@ static int gdb_get_registers_packet(struct connection *connection,
LOG_DEBUG("-");
#endif
- if ((target->rtos) && (ERROR_OK == rtos_get_gdb_reg_list(connection)))
+ if ((target->rtos) && (rtos_get_gdb_reg_list(connection) == ERROR_OK))
return ERROR_OK;
retval = target_get_gdb_reg_list(target, &reg_list, &reg_list_size,
@@ -1342,7 +1342,7 @@ static int gdb_get_register_packet(struct connection *connection,
LOG_DEBUG("-");
#endif
- if ((target->rtos) && (ERROR_OK == rtos_get_gdb_reg(connection, reg_num)))
+ if ((target->rtos) && (rtos_get_gdb_reg(connection, reg_num) == ERROR_OK))
return ERROR_OK;
retval = target_get_gdb_reg_list_noread(target, &reg_list, &reg_list_size,
@@ -1399,7 +1399,7 @@ static int gdb_set_register_packet(struct connection *connection,
gdb_target_to_reg(target, separator + 1, chars, bin_buf);
if ((target->rtos) &&
- (ERROR_OK == rtos_set_reg(connection, reg_num, bin_buf))) {
+ (rtos_set_reg(connection, reg_num, bin_buf) == ERROR_OK)) {
free(bin_buf);
gdb_put_packet(connection, "OK", 2);
return ERROR_OK;
diff --git a/src/svf/svf.c b/src/svf/svf.c
index c93d530..3021dcb 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -460,25 +460,25 @@ COMMAND_HANDLER(handle_svf_command)
}
/* HDR %d TDI (0) */
- if (ERROR_OK != svf_set_padding(&svf_para.hdr_para, header_dr_len, 0)) {
+ if (svf_set_padding(&svf_para.hdr_para, header_dr_len, 0) != ERROR_OK) {
LOG_ERROR("failed to set data header");
return ERROR_FAIL;
}
/* HIR %d TDI (0xFF) */
- if (ERROR_OK != svf_set_padding(&svf_para.hir_para, header_ir_len, 0xFF)) {
+ if (svf_set_padding(&svf_para.hir_para, header_ir_len, 0xFF) != ERROR_OK) {
LOG_ERROR("failed to set instruction header");
return ERROR_FAIL;
}
/* TDR %d TDI (0) */
- if (ERROR_OK != svf_set_padding(&svf_para.tdr_para, trailer_dr_len, 0)) {
+ if (svf_set_padding(&svf_para.tdr_para, trailer_dr_len, 0) != ERROR_OK) {
LOG_ERROR("failed to set data trailer");
return ERROR_FAIL;
}
/* TIR %d TDI (0xFF) */
- if (ERROR_OK != svf_set_padding(&svf_para.tir_para, trailer_ir_len, 0xFF)) {
+ if (svf_set_padding(&svf_para.tir_para, trailer_ir_len, 0xFF) != ERROR_OK) {
LOG_ERROR("failed to set instruction trailer");
return ERROR_FAIL;
}
@@ -492,7 +492,7 @@ COMMAND_HANDLER(handle_svf_command)
}
rewind(svf_fd);
}
- while (ERROR_OK == svf_read_command_from_file(svf_fd)) {
+ while (svf_read_command_from_file(svf_fd) == ERROR_OK) {
/* Log Output */
if (svf_quiet) {
if (svf_progress_enabled) {
@@ -510,7 +510,7 @@ COMMAND_HANDLER(handle_svf_command)
LOG_USER_N("%s", svf_read_line);
}
/* Run Command */
- if (ERROR_OK != svf_run_command(CMD_CTX, svf_command_buffer)) {
+ if (svf_run_command(CMD_CTX, svf_command_buffer) != ERROR_OK) {
LOG_ERROR("fail to run command at line %d", svf_line_number);
ret = ERROR_FAIL;
break;
@@ -518,9 +518,9 @@ COMMAND_HANDLER(handle_svf_command)
command_num++;
}
- if ((!svf_nil) && (ERROR_OK != jtag_execute_queue()))
+ if ((!svf_nil) && (jtag_execute_queue() != ERROR_OK))
ret = ERROR_FAIL;
- else if (ERROR_OK != svf_check_tdo())
+ else if (svf_check_tdo() != ERROR_OK)
ret = ERROR_FAIL;
/* print time */
@@ -790,7 +790,7 @@ static int svf_copy_hexstring_to_binary(char *str, uint8_t **bin, int orig_bit_l
int i, str_len = strlen(str), str_hbyte_len = (bit_len + 3) >> 2;
uint8_t ch = 0;
- if (ERROR_OK != svf_adjust_array_length(bin, orig_bit_len, bit_len)) {
+ if (svf_adjust_array_length(bin, orig_bit_len, bit_len) != ERROR_OK) {
LOG_ERROR("fail to adjust length of array");
return ERROR_FAIL;
}
@@ -893,9 +893,9 @@ static int svf_add_check_para(uint8_t enabled, int buffer_offset, int bit_len)
static int svf_execute_tap(void)
{
- if ((!svf_nil) && (ERROR_OK != jtag_execute_queue()))
+ if ((!svf_nil) && (jtag_execute_queue() != ERROR_OK))
return ERROR_FAIL;
- else if (ERROR_OK != svf_check_tdo())
+ else if (svf_check_tdo() != ERROR_OK)
return ERROR_FAIL;
svf_buffer_index = 0;
@@ -923,7 +923,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str)
/* flag padding commands skipped due to -tap command */
int padding_command_skipped = 0;
- if (ERROR_OK != svf_parse_cmd_string(cmd_str, strlen(cmd_str), argus, &num_of_argu))
+ if (svf_parse_cmd_string(cmd_str, strlen(cmd_str), argus, &num_of_argu) != ERROR_OK)
return ERROR_FAIL;
/* NOTE: we're a bit loose here, because we ignore case in
@@ -963,7 +963,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str)
LOG_ERROR("invalid parameter of %s", argus[0]);
return ERROR_FAIL;
}
- if (1 == num_of_argu) {
+ if (num_of_argu == 1) {
/* TODO: set jtag speed to full speed */
svf_para.frequency = 0;
} else {
@@ -971,7 +971,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str)
LOG_ERROR("HZ not found in FREQUENCY command");
return ERROR_FAIL;
}
- if (ERROR_OK != svf_execute_tap())
+ if (svf_execute_tap() != ERROR_OK)
return ERROR_FAIL;
svf_para.frequency = atof(argus[1]);
/* TODO: set jtag speed to */
@@ -1434,7 +1434,7 @@ xxr_common:
return ERROR_FAIL;
}
/* OpenOCD refuses paths containing TAP_RESET */
- if (TAP_RESET == path[i]) {
+ if (path[i] == TAP_RESET) {
/* FIXME last state MUST be stable! */
if (i > 0) {
if (!svf_nil)
@@ -1487,7 +1487,7 @@ xxr_common:
return ERROR_FAIL;
}
if (svf_para.trst_mode != TRST_ABSENT) {
- if (ERROR_OK != svf_execute_tap())
+ if (svf_execute_tap() != ERROR_OK)
return ERROR_FAIL;
i_tmp = svf_find_string_in_array(argus[1],
(char **)svf_trst_mode_name,
@@ -1530,7 +1530,7 @@ xxr_common:
if ((svf_buffer_index > 0) &&
(((command != STATE) && (command != RUNTEST)) ||
((command == STATE) && (num_of_argu == 2)))) {
- if (ERROR_OK != svf_execute_tap())
+ if (svf_execute_tap() != ERROR_OK)
return ERROR_FAIL;
/* output debug info */
diff --git a/src/target/armv8.c b/src/target/armv8.c
index 43a3659..749ea87 100644
--- a/src/target/armv8.c
+++ b/src/target/armv8.c
@@ -1062,7 +1062,7 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
return ERROR_OK;
}
- while (CMD_ARGC > argp) {
+ while (argp < CMD_ARGC) {
n = jim_nvp_name2value_simple(nvp_ecatch_modes, CMD_ARGV[argp]);
if (!n->name) {
LOG_ERROR("Unknown option: %s", CMD_ARGV[argp]);
diff --git a/src/target/lakemont.c b/src/target/lakemont.c
index c30ac3b..576956e 100644
--- a/src/target/lakemont.c
+++ b/src/target/lakemont.c
@@ -611,7 +611,7 @@ static int read_all_core_hw_regs(struct target *t)
unsigned i;
struct x86_32_common *x86_32 = target_to_x86_32(t);
for (i = 0; i < (x86_32->cache->num_regs); i++) {
- if (NOT_AVAIL_REG == regs[i].pm_idx)
+ if (regs[i].pm_idx == NOT_AVAIL_REG)
continue;
err = read_hw_reg(t, regs[i].id, &regval, 1);
if (err != ERROR_OK) {
@@ -630,7 +630,7 @@ static int write_all_core_hw_regs(struct target *t)
unsigned i;
struct x86_32_common *x86_32 = target_to_x86_32(t);
for (i = 0; i < (x86_32->cache->num_regs); i++) {
- if (NOT_AVAIL_REG == regs[i].pm_idx)
+ if (regs[i].pm_idx == NOT_AVAIL_REG)
continue;
err = write_hw_reg(t, i, 0, 1);
if (err != ERROR_OK) {
diff --git a/src/target/nds32.c b/src/target/nds32.c
index ca665ec..12340ac 100644
--- a/src/target/nds32.c
+++ b/src/target/nds32.c
@@ -95,10 +95,10 @@ static int nds32_get_core_reg(struct reg *reg)
} else {
uint32_t val = 0;
if ((nds32->fpu_enable == false)
- && (NDS32_REG_TYPE_FPU == nds32_reg_type(mapped_regnum))) {
+ && (nds32_reg_type(mapped_regnum) == NDS32_REG_TYPE_FPU)) {
retval = ERROR_OK;
} else if ((nds32->audio_enable == false)
- && (NDS32_REG_TYPE_AUMR == nds32_reg_type(mapped_regnum))) {
+ && (nds32_reg_type(mapped_regnum) == NDS32_REG_TYPE_AUMR)) {
retval = ERROR_OK;
} else {
retval = aice_read_register(aice, mapped_regnum, &val);
@@ -139,7 +139,7 @@ static int nds32_get_core_reg_64(struct reg *reg)
} else {
uint64_t val = 0;
if ((nds32->fpu_enable == false)
- && ((FD0 <= reg_arch_info->num) && (reg_arch_info->num <= FD31))) {
+ && ((reg_arch_info->num >= FD0) && (reg_arch_info->num <= FD31))) {
retval = ERROR_OK;
} else {
retval = aice_read_reg_64(aice, reg_arch_info->num, &val);
@@ -193,7 +193,7 @@ static int nds32_update_cache_info(struct nds32 *nds32)
{
uint32_t value;
- if (ERROR_OK == nds32_get_mapped_reg(nds32, MR8, &value)) {
+ if (nds32_get_mapped_reg(nds32, MR8, &value) == ERROR_OK) {
if (value & 0x1)
nds32->memory.icache.enable = true;
else
@@ -308,11 +308,11 @@ static int nds32_set_core_reg(struct reg *reg, uint8_t *buf)
reg_arch_info->num, reg->name, value);
if ((nds32->fpu_enable == false) &&
- (NDS32_REG_TYPE_FPU == nds32_reg_type(mapped_regnum))) {
+ (nds32_reg_type(mapped_regnum) == NDS32_REG_TYPE_FPU)) {
buf_set_u32(reg->value, 0, 32, 0);
} else if ((nds32->audio_enable == false) &&
- (NDS32_REG_TYPE_AUMR == nds32_reg_type(mapped_regnum))) {
+ (nds32_reg_type(mapped_regnum) == NDS32_REG_TYPE_AUMR)) {
buf_set_u32(reg->value, 0, 32, 0);
} else {
@@ -361,7 +361,7 @@ static int nds32_set_core_reg_64(struct reg *reg, uint8_t *buf)
}
if ((nds32->fpu_enable == false) &&
- ((FD0 <= reg_arch_info->num) && (reg_arch_info->num <= FD31))) {
+ ((reg_arch_info->num >= FD0) && (reg_arch_info->num <= FD31))) {
buf_set_u32(reg->value, 0, 32, 0);
buf_set_u32(reg->value, 32, 32, 0);
@@ -434,7 +434,7 @@ static struct reg_cache *nds32_build_reg_cache(struct target *target,
reg_list[i].type = &nds32_reg_access_type;
reg_list[i].group = "general";
- if ((FS0 <= reg_arch_info[i].num) && (reg_arch_info[i].num <= FS31)) {
+ if ((reg_arch_info[i].num >= FS0) && (reg_arch_info[i].num <= FS31)) {
reg_list[i].reg_data_type->type = REG_TYPE_IEEE_SINGLE;
reg_list[i].reg_data_type->id = "ieee_single";
reg_list[i].group = "float";
@@ -531,7 +531,7 @@ int nds32_get_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t *value)
r = nds32_reg_current(nds32, regnum);
- if (ERROR_OK != r->type->get(r))
+ if (r->type->get(r) != ERROR_OK)
return ERROR_FAIL;
*value = buf_get_u32(r->value, 0, 32);
@@ -636,7 +636,7 @@ static int nds32_select_memory_mode(struct target *target, uint32_t address,
/* init end_address */
*end_address = address_end;
- if (NDS_MEMORY_ACC_CPU == memory->access_channel)
+ if (memory->access_channel == NDS_MEMORY_ACC_CPU)
return ERROR_OK;
if (edm->access_control == false) {
@@ -650,7 +650,7 @@ static int nds32_select_memory_mode(struct target *target, uint32_t address,
return ERROR_OK;
}
- if (NDS_MEMORY_SELECT_AUTO != memory->mode) {
+ if (memory->mode != NDS_MEMORY_SELECT_AUTO) {
LOG_DEBUG("Memory mode is not AUTO");
return ERROR_OK;
}
@@ -727,7 +727,7 @@ int nds32_read_buffer(struct target *target, uint32_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -850,7 +850,7 @@ int nds32_write_buffer(struct target *target, uint32_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -1576,7 +1576,7 @@ int nds32_edm_config(struct nds32 *nds32)
nds32->edm.breakpoint_num = (edm_cfg & 0x7) + 1;
- if ((nds32->edm.version & 0x1000) || (0x60 <= nds32->edm.version))
+ if ((nds32->edm.version & 0x1000) || (nds32->edm.version >= 0x60))
nds32->edm.access_control = true;
else
nds32->edm.access_control = false;
@@ -1661,10 +1661,10 @@ int nds32_init_arch_info(struct target *target, struct nds32 *nds32)
nds32_reg_init();
- if (ERROR_FAIL == nds32_reg_cache_init(target, nds32))
+ if (nds32_reg_cache_init(target, nds32) == ERROR_FAIL)
return ERROR_FAIL;
- if (ERROR_OK != nds32_init_register_table(nds32))
+ if (nds32_init_register_table(nds32) != ERROR_OK)
return ERROR_FAIL;
return ERROR_OK;
@@ -1679,10 +1679,10 @@ int nds32_virtual_to_physical(struct target *target, target_addr_t address, targ
return ERROR_OK;
}
- if (ERROR_OK == nds32_probe_tlb(nds32, address, physical))
+ if (nds32_probe_tlb(nds32, address, physical) == ERROR_OK)
return ERROR_OK;
- if (ERROR_OK == nds32_walk_page_table(nds32, address, physical))
+ if (nds32_walk_page_table(nds32, address, physical) == ERROR_OK)
return ERROR_OK;
return ERROR_FAIL;
@@ -1799,7 +1799,7 @@ int nds32_step(struct target *target, int current,
if (no_step == false) {
struct aice_port_s *aice = target_to_aice(target);
- if (ERROR_OK != aice_step(aice))
+ if (aice_step(aice) != ERROR_OK)
return ERROR_FAIL;
}
@@ -1842,7 +1842,7 @@ static int nds32_step_without_watchpoint(struct nds32 *nds32)
struct aice_port_s *aice = target_to_aice(target);
- if (ERROR_OK != aice_step(aice))
+ if (aice_step(aice) != ERROR_OK)
return ERROR_FAIL;
/* save state */
@@ -1923,7 +1923,7 @@ int nds32_examine_debug_reason(struct nds32 *nds32)
nds32_get_mapped_reg(nds32, PC, &value_pc);
- if (ERROR_OK != nds32_read_opcode(nds32, value_pc, &opcode))
+ if (nds32_read_opcode(nds32, value_pc, &opcode) != ERROR_OK)
return ERROR_FAIL;
if (nds32_evaluate_opcode(nds32, opcode, value_pc, &instruction) != ERROR_OK)
return ERROR_FAIL;
@@ -2009,7 +2009,7 @@ int nds32_login(struct nds32 *nds32)
strcat(command_sequence, command_str);
}
- if (ERROR_OK != aice_program_edm(aice, command_sequence))
+ if (aice_program_edm(aice, command_sequence) != ERROR_OK)
return ERROR_FAIL;
/* get current privilege level */
@@ -2031,7 +2031,7 @@ int nds32_login(struct nds32 *nds32)
return ERROR_FAIL;
sprintf(command_str, "write_misc %s 0x%" PRIx32 ";", reg_name, code);
- if (ERROR_OK != aice_program_edm(aice, command_str))
+ if (aice_program_edm(aice, command_str) != ERROR_OK)
return ERROR_FAIL;
}
}
@@ -2058,7 +2058,7 @@ int nds32_halt(struct target *target)
if (state != TARGET_HALTED)
/* TODO: if state == TARGET_HALTED, check ETYPE is DBGI or not */
- if (ERROR_OK != aice_halt(aice))
+ if (aice_halt(aice) != ERROR_OK)
return ERROR_FAIL;
CHECK_RETVAL(nds32->enter_debug_state(nds32, true));
@@ -2080,7 +2080,7 @@ int nds32_poll(struct target *target)
if (state == TARGET_HALTED) {
if (target->state != TARGET_HALTED) {
/* if false_hit, continue free_run */
- if (ERROR_OK != nds32->enter_debug_state(nds32, true)) {
+ if (nds32->enter_debug_state(nds32, true) != ERROR_OK) {
struct aice_port_s *aice = target_to_aice(target);
aice_run(aice);
return ERROR_OK;
@@ -2510,8 +2510,8 @@ int nds32_profiling(struct target *target, uint32_t *samples,
int nds32_gdb_fileio_write_memory(struct nds32 *nds32, uint32_t address,
uint32_t size, const uint8_t *buffer)
{
- if ((NDS32_SYSCALL_FSTAT == nds32->active_syscall_id) ||
- (NDS32_SYSCALL_STAT == nds32->active_syscall_id)) {
+ if ((nds32->active_syscall_id == NDS32_SYSCALL_FSTAT) ||
+ (nds32->active_syscall_id == NDS32_SYSCALL_STAT)) {
/* If doing GDB file-I/O, target should convert 'struct stat'
* from gdb-format to target-format */
uint8_t stat_buffer[NDS32_STRUCT_STAT_SIZE];
@@ -2594,7 +2594,7 @@ int nds32_gdb_fileio_write_memory(struct nds32 *nds32, uint32_t address,
stat_buffer[59] = 0;
return nds32_write_buffer(nds32->target, address, NDS32_STRUCT_STAT_SIZE, stat_buffer);
- } else if (NDS32_SYSCALL_GETTIMEOFDAY == nds32->active_syscall_id) {
+ } else if (nds32->active_syscall_id == NDS32_SYSCALL_GETTIMEOFDAY) {
/* If doing GDB file-I/O, target should convert 'struct timeval'
* from gdb-format to target-format */
uint8_t timeval_buffer[NDS32_STRUCT_TIMEVAL_SIZE];
diff --git a/src/target/nds32_cmd.c b/src/target/nds32_cmd.c
index 9c7d055..69c28ac 100644
--- a/src/target/nds32_cmd.c
+++ b/src/target/nds32_cmd.c
@@ -575,7 +575,7 @@ COMMAND_HANDLER(handle_nds32_decode_command)
read_addr = addr;
i = 0;
while (i < insn_count) {
- if (ERROR_OK != nds32_read_opcode(nds32, read_addr, &opcode))
+ if (nds32_read_opcode(nds32, read_addr, &opcode) != ERROR_OK)
return ERROR_FAIL;
if (nds32_evaluate_opcode(nds32, opcode, read_addr, &instruction) != ERROR_OK)
return ERROR_FAIL;
@@ -593,9 +593,9 @@ COMMAND_HANDLER(handle_nds32_decode_command)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
- if (ERROR_OK != nds32_read_opcode(nds32, addr, &opcode))
+ if (nds32_read_opcode(nds32, addr, &opcode) != ERROR_OK)
return ERROR_FAIL;
- if (ERROR_OK != nds32_evaluate_opcode(nds32, opcode, addr, &instruction))
+ if (nds32_evaluate_opcode(nds32, opcode, addr, &instruction) != ERROR_OK)
return ERROR_FAIL;
command_print(CMD, "%s", instruction.text);
diff --git a/src/target/nds32_v2.c b/src/target/nds32_v2.c
index 8916a59..49a5758 100644
--- a/src/target/nds32_v2.c
+++ b/src/target/nds32_v2.c
@@ -36,7 +36,7 @@ static int nds32_v2_register_mapping(struct nds32 *nds32, int reg_no)
uint32_t max_level = nds32->max_interrupt_level;
uint32_t cur_level = nds32->current_interrupt_level;
- if ((1 <= cur_level) && (cur_level < max_level)) {
+ if ((cur_level >= 1) && (cur_level < max_level)) {
if (reg_no == IR0) {
LOG_DEBUG("Map PSW to IPSW");
return IR1;
@@ -44,7 +44,7 @@ static int nds32_v2_register_mapping(struct nds32 *nds32, int reg_no)
LOG_DEBUG("Map PC to IPC");
return IR9;
}
- } else if ((2 <= cur_level) && (cur_level < max_level)) {
+ } else if ((cur_level >= 2) && (cur_level < max_level)) {
if (reg_no == R26) {
LOG_DEBUG("Mapping P0 to P_P0");
return IR12;
@@ -308,7 +308,7 @@ static int nds32_v2_debug_entry(struct nds32 *nds32, bool enable_watchpoint)
if (enable_watchpoint)
CHECK_RETVAL(nds32_v2_deactivate_hardware_watchpoint(nds32->target));
- if (ERROR_OK != nds32_examine_debug_reason(nds32)) {
+ if (nds32_examine_debug_reason(nds32) != ERROR_OK) {
nds32->target->state = backup_state;
/* re-activate all hardware breakpoints & watchpoints */
@@ -644,10 +644,10 @@ static int nds32_v2_translate_address(struct target *target, target_addr_t *addr
/* Following conditions need to do address translation
* 1. BUS mode
* 2. CPU mode under maximum interrupt level */
- if ((NDS_MEMORY_ACC_BUS == memory->access_channel) ||
- ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_BUS) ||
+ ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
nds32_reach_max_interrupt_level(nds32))) {
- if (ERROR_OK == target->type->virt2phys(target, *address, &physical_address))
+ if (target->type->virt2phys(target, *address, &physical_address) == ERROR_OK)
*address = physical_address;
else
return ERROR_FAIL;
@@ -662,7 +662,7 @@ static int nds32_v2_read_buffer(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -682,7 +682,7 @@ static int nds32_v2_write_buffer(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -702,7 +702,7 @@ static int nds32_v2_read_memory(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -722,7 +722,7 @@ static int nds32_v2_write_memory(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
diff --git a/src/target/nds32_v3_common.c b/src/target/nds32_v3_common.c
index 3abb3b9..b0c3de6 100644
--- a/src/target/nds32_v3_common.c
+++ b/src/target/nds32_v3_common.c
@@ -93,7 +93,7 @@ static int nds32_v3_debug_entry(struct nds32 *nds32, bool enable_watchpoint)
}
}
- if (ERROR_OK != nds32_examine_debug_reason(nds32)) {
+ if (nds32_examine_debug_reason(nds32) != ERROR_OK) {
nds32->target->state = backup_state;
/* re-activate all hardware breakpoints & watchpoints */
@@ -450,7 +450,7 @@ int nds32_v3_read_buffer(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -474,7 +474,7 @@ int nds32_v3_read_buffer(struct target *target, target_addr_t address,
* Because hardware will turn off IT/DT by default, it MUST translate virtual address
* to physical address.
*/
- if (ERROR_OK == target->type->virt2phys(target, address, &physical_address))
+ if (target->type->virt2phys(target, address, &physical_address) == ERROR_OK)
address = physical_address;
else
return ERROR_FAIL;
@@ -508,7 +508,7 @@ int nds32_v3_write_buffer(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -532,7 +532,7 @@ int nds32_v3_write_buffer(struct target *target, target_addr_t address,
* Because hardware will turn off IT/DT by default, it MUST translate virtual address
* to physical address.
*/
- if (ERROR_OK == target->type->virt2phys(target, address, &physical_address))
+ if (target->type->virt2phys(target, address, &physical_address) == ERROR_OK)
address = physical_address;
else
return ERROR_FAIL;
@@ -570,7 +570,7 @@ int nds32_v3_read_memory(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -594,7 +594,7 @@ int nds32_v3_read_memory(struct target *target, target_addr_t address,
* Because hardware will turn off IT/DT by default, it MUST translate virtual address
* to physical address.
*/
- if (ERROR_OK == target->type->virt2phys(target, address, &physical_address))
+ if (target->type->virt2phys(target, address, &physical_address) == ERROR_OK)
address = physical_address;
else
return ERROR_FAIL;
@@ -628,7 +628,7 @@ int nds32_v3_write_memory(struct target *target, target_addr_t address,
struct nds32 *nds32 = target_to_nds32(target);
struct nds32_memory *memory = &(nds32->memory);
- if ((NDS_MEMORY_ACC_CPU == memory->access_channel) &&
+ if ((memory->access_channel == NDS_MEMORY_ACC_CPU) &&
(target->state != TARGET_HALTED)) {
LOG_WARNING("target was not halted");
return ERROR_TARGET_NOT_HALTED;
@@ -652,7 +652,7 @@ int nds32_v3_write_memory(struct target *target, target_addr_t address,
* Because hardware will turn off IT/DT by default, it MUST translate virtual address
* to physical address.
*/
- if (ERROR_OK == target->type->virt2phys(target, address, &physical_address))
+ if (target->type->virt2phys(target, address, &physical_address) == ERROR_OK)
address = physical_address;
else
return ERROR_FAIL;
diff --git a/src/target/target.c b/src/target/target.c
index 37bbd37..cf1873c 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5724,7 +5724,7 @@ static int target_create(struct jim_getopt_info *goi)
}
/* now does target type exist */
for (x = 0 ; target_types[x] ; x++) {
- if (0 == strcmp(cp, target_types[x]->name)) {
+ if (strcmp(cp, target_types[x]->name) == 0) {
/* found */
break;
}