diff --git a/.travis.yml b/.travis.yml index a8b919cca..2aeed080b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,11 @@ matrix: - binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 script: - - set -o pipefail - - git diff `git merge-base master HEAD` | ./tools/scripts/checkpatch.pl - + # Ideally we'd diff back to where we either branched off OpenOCD or master, + # or riscv. But that's tricky, and the default git clone only gets the last + # 50 changes any case. Most merges won't consist of more than 40 changes, + # so this should work fine most of the time, and be a lot better than not + # checking at all. + - git diff HEAD~40 | ./tools/scripts/checkpatch.pl --no-signoff - - ./bootstrap && ./configure --enable-remote-bitbang --enable-jtag_vpi $CONFIGURE_ARGS && make - file src/$EXECUTABLE diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c index b450d2b0f..4322f7b63 100644 --- a/src/target/riscv/riscv-011.c +++ b/src/target/riscv/riscv-011.c @@ -455,12 +455,12 @@ static uint64_t dbus_read(struct target *target, uint16_t address) uint64_t value; dbus_status_t status; uint16_t address_in; - + /* If the previous read/write was to the same address, we will get the read data * from the previous access. * While somewhat nonintuitive, this is an efficient way to get the data. */ - + unsigned i = 0; do { status = dbus_scan(target, &address_in, &value, DBUS_OP_READ, address, 0); @@ -680,7 +680,7 @@ static bits_t read_bits(struct target *target) } increase_dbus_busy_delay(target); } else if (status == DBUS_STATUS_FAILED) { - // TODO: return an actual error + /* TODO: return an actual error */ return err_result; } } while (status == DBUS_STATUS_BUSY && i++ < 256); diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 85d0ca966..f39aa7040 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -250,9 +250,8 @@ static dm013_info_t *get_dm(struct target *target) info->dm = dm; target_list_t *target_entry; list_for_each_entry(target_entry, &dm->target_list, list) { - if (target_entry->target == target) { + if (target_entry->target == target) return dm; - } } target_entry = calloc(1, sizeof(*target_entry)); target_entry->target = target; @@ -1781,19 +1780,16 @@ static int sb_write_address(struct target *target, target_addr_t address) RISCV013_INFO(info); unsigned sbasize = get_field(info->sbcs, DMI_SBCS_SBASIZE); /* There currently is no support for >64-bit addresses in OpenOCD. */ - if (sbasize > 96) { + if (sbasize > 96) dmi_write(target, DMI_SBADDRESS3, 0); - } - if (sbasize > 64) { + if (sbasize > 64) dmi_write(target, DMI_SBADDRESS2, 0); - } - if (sbasize > 32) { + if (sbasize > 32) #if BUILD_TARGET64 dmi_write(target, DMI_SBADDRESS1, address >> 32); #else dmi_write(target, DMI_SBADDRESS1, 0); #endif - } return dmi_write(target, DMI_SBADDRESS0, address); } diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 97605c006..042529477 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1125,16 +1125,14 @@ int riscv_openocd_resume( while (watchpoint && result == ERROR_OK) { LOG_DEBUG("watchpoint %d: set=%d", i, watchpoint->set); trigger_temporarily_cleared[i] = watchpoint->set; - if (watchpoint->set) { + if (watchpoint->set) result = riscv_remove_watchpoint(target, watchpoint); - } watchpoint = watchpoint->next; i++; } - if (result == ERROR_OK) { + if (result == ERROR_OK) result = riscv_step_rtos_hart(target); - } watchpoint = target->watchpoints; i = 0; @@ -1256,7 +1254,7 @@ COMMAND_HANDLER(riscv_set_scratch_ram) return ERROR_OK; } - /** TODO: use COMMAND_PARSE_NUMBER **/ + /* TODO: use COMMAND_PARSE_NUMBER */ long long unsigned int address; int result = sscanf(CMD_ARGV[0], "%llx", &address); if (result != (int) strlen(CMD_ARGV[0])) {