From fec3b224214e3784b0c00970d2421212402da880 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 8 Sep 2024 21:47:31 +0200 Subject: [PATCH] target: riscv: remove non-trivial 'unsigned' cast Change the prototype of riscv_batch_get_dmi_read_op(). Now that 'target->smp' is unsigned, drop the cast. Change-Id: I2a54268ed1e4bf0ea884b62cceb73f5c7451da78 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/8484 Tested-by: jenkins --- src/target/riscv/batch.c | 4 ++-- src/target/riscv/batch.h | 2 +- src/target/riscv/riscv-013.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/target/riscv/batch.c b/src/target/riscv/batch.c index 859e2275e..e3f8ff3d4 100644 --- a/src/target/riscv/batch.c +++ b/src/target/riscv/batch.c @@ -156,14 +156,14 @@ size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned int address) return batch->read_keys_used++; } -unsigned int riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key) +uint32_t riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key) { assert(key < batch->read_keys_used); size_t index = batch->read_keys[key]; assert(index <= batch->used_scans); uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index; /* extract "op" field from the DMI read result */ - return (unsigned)buf_get_u32(base, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH); + return buf_get_u32(base, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH); } uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key) diff --git a/src/target/riscv/batch.h b/src/target/riscv/batch.h index e5b94cc21..537fa5923 100644 --- a/src/target/riscv/batch.h +++ b/src/target/riscv/batch.h @@ -65,7 +65,7 @@ void riscv_batch_add_dmi_write(struct riscv_batch *batch, unsigned int address, * provides a key, the second one actually obtains the result of the read - * status (op) and the actual data. */ size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned int address); -unsigned int riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key); +uint32_t riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key); uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key); /* Scans in a NOP. */ diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 16eced2d8..6c9ed317b 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1537,7 +1537,7 @@ static int set_haltgroup(struct target *target, bool *supported) uint32_t read; if (dmi_read(target, &read, DM_DMCS2) != ERROR_OK) return ERROR_FAIL; - *supported = get_field(read, DM_DMCS2_GROUP) == (unsigned)target->smp; + *supported = get_field(read, DM_DMCS2_GROUP) == target->smp; return ERROR_OK; }