From b10049d847fac855b1139d6441de853641b7365b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 28 Jan 2022 15:44:03 -0800 Subject: [PATCH] ao_task: Task ids are 8-bits, fix type in struct ao_task These are densely allocated and should never be larger than the maximum number of task slots, so fix the type to be 8-bits just like all other places where a task_id is used. Signed-off-by: Keith Packard --- src/kernel/ao_storage.c | 6 +++--- src/kernel/ao_task.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/ao_storage.c b/src/kernel/ao_storage.c index 43abc43c..a2c3738d 100644 --- a/src/kernel/ao_storage.c +++ b/src/kernel/ao_storage.c @@ -39,7 +39,7 @@ ao_storage_read(ao_pos_t pos, void *v_buf, uint16_t len) /* Compute portion of transfer within * a single block */ - this_off = (uint16_t) pos & (ao_storage_unit - 1); + this_off = (uint16_t) (pos & (ao_storage_unit - 1)); this_len = ao_storage_unit - this_off; if (this_len > len) this_len = len; @@ -70,7 +70,7 @@ ao_storage_write(ao_pos_t pos, void *v_buf, uint16_t len) /* Compute portion of transfer within * a single block */ - this_off = (uint16_t) pos & (ao_storage_unit - 1); + this_off = (uint16_t) (pos & (ao_storage_unit - 1)); this_len = ao_storage_unit - this_off; if (this_len > len) this_len = len; @@ -102,7 +102,7 @@ ao_storage_is_erased(uint32_t pos) uint32_t this_time = AO_STORAGE_DATA_SIZE; if (this_time > read_len) this_time = read_len; - if (!ao_storage_read(read_pos, storage_data, this_time)) { + if (!ao_storage_read(read_pos, storage_data, (uint16_t) this_time)) { ret = 0; goto done; } diff --git a/src/kernel/ao_task.h b/src/kernel/ao_task.h index beb4da30..9197e25c 100644 --- a/src/kernel/ao_task.h +++ b/src/kernel/ao_task.h @@ -38,7 +38,7 @@ struct ao_task { void *wchan; /* current wait channel (NULL if running) */ AO_TICK_TYPE alarm; /* abort ao_sleep time */ - uint16_t task_id; /* unique id */ + uint8_t task_id; /* unique id */ /* Saved stack pointer */ union { uint32_t *sp32; -- 2.30.2