aboutsummaryrefslogtreecommitdiff
path: root/src/server/gdb_server.c
diff options
context:
space:
mode:
authorMarc Schink <dev@zapb.de>2020-06-07 17:00:13 +0200
committerTomas Vanek <vanekt@fbl.cz>2020-07-07 05:23:54 +0100
commitef14384b681af4f731f768bb866457832af6925f (patch)
treea8cb953d765484d4cd627eaa7ea71d9be6699866 /src/server/gdb_server.c
parenta2e6982a1816a0229bd5644156f3025a0e8cb6ce (diff)
downloadriscv-openocd-ef14384b681af4f731f768bb866457832af6925f.zip
riscv-openocd-ef14384b681af4f731f768bb866457832af6925f.tar.gz
riscv-openocd-ef14384b681af4f731f768bb866457832af6925f.tar.bz2
flash/nor: Use proper data types in driver API
Use 'unsigned int' and 'bool' instead of 'int' where appropriate. While at it, fix some coding style issues. No new Clang analyzer warnings. Change-Id: I700802c9ee81c3c7ae73108f0f8f06b15a4345f8 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/4929 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/server/gdb_server.c')
-rw-r--r--src/server/gdb_server.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 6a9e261..0e0b595 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -996,8 +996,7 @@ static int gdb_new_connection(struct connection *connection)
* This will cause an auto_probe to be invoked, which is either
* a no-op or it will fail when the target isn't ready(e.g. not halted).
*/
- int i;
- for (i = 0; i < flash_get_bank_count(); i++) {
+ for (unsigned int i = 0; i < flash_get_bank_count(); i++) {
struct flash_bank *p;
p = get_flash_bank_by_num_noprobe(i);
if (p->target != target)
@@ -1831,8 +1830,7 @@ static int gdb_memory_map(struct connection *connection,
int length;
char *separator;
target_addr_t ram_start = 0;
- int i;
- int target_flash_banks = 0;
+ unsigned int target_flash_banks = 0;
/* skip command character */
packet += 23;
@@ -1848,7 +1846,7 @@ static int gdb_memory_map(struct connection *connection,
*/
banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count());
- for (i = 0; i < flash_get_bank_count(); i++) {
+ for (unsigned int i = 0; i < flash_get_bank_count(); i++) {
p = get_flash_bank_by_num_noprobe(i);
if (p->target != target)
continue;
@@ -1864,8 +1862,7 @@ static int gdb_memory_map(struct connection *connection,
qsort(banks, target_flash_banks, sizeof(struct flash_bank *),
compare_bank);
- for (i = 0; i < target_flash_banks; i++) {
- int j;
+ for (unsigned int i = 0; i < target_flash_banks; i++) {
unsigned sector_size = 0;
unsigned group_len = 0;
@@ -1883,7 +1880,7 @@ static int gdb_memory_map(struct connection *connection,
* smaller ones at the end (maybe 32KB). STR7 will have
* regions with 8KB, 32KB, and 64KB sectors; etc.
*/
- for (j = 0; j < p->num_sectors; j++) {
+ for (unsigned int j = 0; j < p->num_sectors; j++) {
/* Maybe start a new group of sectors. */
if (sector_size == 0) {
@@ -3117,7 +3114,7 @@ static int gdb_v_packet(struct connection *connection,
target_call_event_callbacks(target,
TARGET_EVENT_GDB_FLASH_WRITE_START);
result = flash_write(target, gdb_connection->vflash_image,
- &written, 0);
+ &written, false);
target_call_event_callbacks(target,
TARGET_EVENT_GDB_FLASH_WRITE_END);
if (result != ERROR_OK) {