From 83d793839479a6f3414dbf51c00536aff65618f3 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 20 Sep 2019 10:04:44 -0700 Subject: host_command: Change host command return value to enum ec_status If the host command handler callback function returns an int, it's easy to accidentally mix up the enum ec_error_list and enum ec_status types. The host commands always expect an enum ec_status type, so we change the return value to be of that explicit type. Compilation will then fail if you accidentally try to return an enum ec_error_list value. Ran the following commands and then manually fixed up a few remaining instances that were not caught: git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\ static enum ec_status \1(struct host_cmd_handler_args \*args)##' git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\ enum ec_status \1(struct host_cmd_handler_args \*args)##' BRANCH=none BUG=chromium:1004831 TEST=make buildall -j Cq-Depend: chrome-internal:1872675 Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e Signed-off-by: Tom Hughes Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865 Reviewed-by: Daisuke Nojiri Reviewed-by: Jack Rosenthal --- common/fpsensor/fpsensor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'common/fpsensor/fpsensor.c') diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c index 11060baf6c..5574a625fb 100644 --- a/common/fpsensor/fpsensor.c +++ b/common/fpsensor/fpsensor.c @@ -289,7 +289,7 @@ void fp_task(void) #endif /* !HAVE_FP_PRIVATE_DRIVER */ } -static int fp_command_passthru(struct host_cmd_handler_args *args) +static enum ec_status fp_command_passthru(struct host_cmd_handler_args *args) { const struct ec_params_fp_passthru *params = args->params; void *out = args->response; @@ -321,7 +321,7 @@ static int fp_command_passthru(struct host_cmd_handler_args *args) } DECLARE_HOST_COMMAND(EC_CMD_FP_PASSTHRU, fp_command_passthru, EC_VER_MASK(0)); -static int fp_command_info(struct host_cmd_handler_args *args) +static enum ec_status fp_command_info(struct host_cmd_handler_args *args) { struct ec_response_fp_info *r = args->response; @@ -355,7 +355,7 @@ static int validate_fp_buffer_offset(const uint32_t buffer_size, return EC_SUCCESS; } -static int fp_command_frame(struct host_cmd_handler_args *args) +static enum ec_status fp_command_frame(struct host_cmd_handler_args *args) { const struct ec_params_fp_frame *params = args->params; void *out = args->response; @@ -443,7 +443,7 @@ static int fp_command_frame(struct host_cmd_handler_args *args) } DECLARE_HOST_COMMAND(EC_CMD_FP_FRAME, fp_command_frame, EC_VER_MASK(0)); -static int fp_command_stats(struct host_cmd_handler_args *args) +static enum ec_status fp_command_stats(struct host_cmd_handler_args *args) { struct ec_response_fp_stats *r = args->response; @@ -470,7 +470,7 @@ static int validate_template_format( return EC_RES_SUCCESS; } -static int fp_command_template(struct host_cmd_handler_args *args) +static enum ec_status fp_command_template(struct host_cmd_handler_args *args) { const struct ec_params_fp_template *params = args->params; uint32_t size = params->size & ~FP_TEMPLATE_COMMIT; -- cgit v1.2.1