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 --- chip/npcx/system.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'chip/npcx/system.c') diff --git a/chip/npcx/system.c b/chip/npcx/system.c index 7eb95b8d34..e247989693 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -999,7 +999,7 @@ DECLARE_CONSOLE_COMMAND(rtc_alarm, command_rtc_alarm_test, /* Host commands */ #ifdef CONFIG_HOSTCMD_RTC -static int system_rtc_get_value(struct host_cmd_handler_args *args) +static enum ec_status system_rtc_get_value(struct host_cmd_handler_args *args) { struct ec_response_rtc *r = args->response; @@ -1012,7 +1012,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_GET_VALUE, system_rtc_get_value, EC_VER_MASK(0)); -static int system_rtc_set_value(struct host_cmd_handler_args *args) +static enum ec_status system_rtc_set_value(struct host_cmd_handler_args *args) { const struct ec_params_rtc *p = args->params; @@ -1023,7 +1023,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_VALUE, system_rtc_set_value, EC_VER_MASK(0)); -static int system_rtc_set_alarm(struct host_cmd_handler_args *args) +static enum ec_status system_rtc_set_alarm(struct host_cmd_handler_args *args) { const struct ec_params_rtc *p = args->params; @@ -1034,7 +1034,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_ALARM, system_rtc_set_alarm, EC_VER_MASK(0)); -static int system_rtc_get_alarm(struct host_cmd_handler_args *args) +static enum ec_status system_rtc_get_alarm(struct host_cmd_handler_args *args) { struct ec_response_rtc *r = args->response; -- cgit v1.2.1