diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-01-19 13:33:21 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-02-01 21:29:33 -0800 |
commit | ebb34ee92f06eab6405397a6e5550dd13779c7d7 (patch) | |
tree | 391f9dd65a8d206d3c3973ab5cd3a00b2be3b79c /common/cbi.c | |
parent | 74e2f686a9acce51b1507367c29e39f504aaa34d (diff) | |
download | chrome-ec-ebb34ee92f06eab6405397a6e5550dd13779c7d7.tar.gz |
CBI: Return ACCESS_DENIED on write failure due to WP
This patch makes EC_CMD_SET_CROS_BOARD_INFO return
EC_RES_ACCESS_DENIED if the command fails due to write-protect
switch.
BUG=b:70294260
BRANCH=none
TEST=Verify 'ectool cbi set 2 4' prints 'WP enabled?' when WP
is enabled.
Change-Id: I7c27ee748caf32e57f22ab79edcbff96e42c44ad
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/897683
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'common/cbi.c')
-rw-r--r-- | common/cbi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/common/cbi.c b/common/cbi.c index c0cba85e4a..7d7594df98 100644 --- a/common/cbi.c +++ b/common/cbi.c @@ -202,6 +202,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CROS_BOARD_INFO, static int hc_cbi_set(struct host_cmd_handler_args *args) { const struct __ec_align4 ec_params_set_cbi *p = args->params; + int rv; if (p->flag & CBI_SET_INIT) { memset(&bi, 0, sizeof(bi)); @@ -243,8 +244,10 @@ static int hc_cbi_set(struct host_cmd_handler_args *args) if (p->flag & CBI_SET_NO_SYNC) return EC_RES_SUCCESS; - if (write_board_info()) - return EC_RES_ERROR; + rv = write_board_info(); + if (rv) + return (rv == EC_ERROR_ACCESS_DENIED) ? + EC_RES_ACCESS_DENIED : EC_RES_ERROR; return EC_RES_SUCCESS; } |