Skip to content

Commit 020eba3

Browse files
thughesChromeos LUCI
authored andcommitted
fpsensor: Use consistent unsigned type for finger index
This is a followup to https://crrev.com/c/3872809, which changed the variable tracking the number of fingers to a consistent type (uint16_t). BRANCH=none BUG=b:244781166 TEST=./test/run_device_tests.py --board dartmonkey => PASS TEST=./test/run_device_tests.py --board bloonchipper => PASS TEST=Flash firmware on gimble, enroll, lock, unlock Change-Id: I1f414fc2bf3ccb229ad074f73eaf4a51fa252bdb Signed-off-by: Tom Hughes <[email protected]> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4382560 Reviewed-by: Yi Chou <[email protected]>
1 parent f745523 commit 020eba3

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

common/fpsensor/fpsensor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static enum ec_status fp_command_frame(struct host_cmd_handler_args *args)
412412
const auto *params =
413413
static_cast<const struct ec_params_fp_frame *>(args->params);
414414
void *out = args->response;
415-
uint32_t idx = FP_FRAME_GET_BUFFER_INDEX(params->offset);
415+
uint16_t idx = FP_FRAME_GET_BUFFER_INDEX(params->offset);
416416
uint32_t offset = params->offset & FP_FRAME_OFFSET_MASK;
417417
uint32_t size = params->size;
418418
uint16_t fgr;
@@ -579,7 +579,7 @@ static enum ec_status fp_command_template(struct host_cmd_handler_args *args)
579579
uint32_t size = params->size & ~FP_TEMPLATE_COMMIT;
580580
bool xfer_complete = params->size & FP_TEMPLATE_COMMIT;
581581
uint32_t offset = params->offset;
582-
uint32_t idx = templ_valid;
582+
uint16_t idx = templ_valid;
583583
uint8_t key[SBP_ENC_KEY_LEN];
584584
struct ec_fp_template_encryption_metadata *enc_info;
585585
int ret;

common/fpsensor/fpsensor_state.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void fp_task_simulate(void)
6969
task_wait_event(timeout_us);
7070
}
7171

72-
void fp_clear_finger_context(int idx)
72+
void fp_clear_finger_context(uint16_t idx)
7373
{
7474
always_memset(fp_template[idx], 0, sizeof(fp_template[0]));
7575
always_memset(fp_positive_match_salt[idx], 0,
@@ -83,15 +83,13 @@ void fp_clear_finger_context(int idx)
8383
*/
8484
static void _fp_clear_context(void)
8585
{
86-
int idx;
87-
8886
templ_valid = 0;
8987
templ_dirty = 0;
9088
always_memset(fp_buffer, 0, sizeof(fp_buffer));
9189
always_memset(fp_enc_buffer, 0, sizeof(fp_enc_buffer));
9290
always_memset(user_id, 0, sizeof(user_id));
9391
fp_disable_positive_match_secret(&positive_match_secret_state);
94-
for (idx = 0; idx < FP_MAX_FINGER_COUNT; idx++)
92+
for (uint16_t idx = 0; idx < FP_MAX_FINGER_COUNT; idx++)
9593
fp_clear_finger_context(idx);
9694
}
9795

include/fpsensor_state.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void fp_task_simulate(void);
9191
*
9292
* @param idx the index of the template to clear.
9393
*/
94-
void fp_clear_finger_context(int idx);
94+
void fp_clear_finger_context(uint16_t idx);
9595

9696
/**
9797
* Clear all fingerprint templates associated with the current user id and

0 commit comments

Comments
 (0)