summaryrefslogtreecommitdiff
path: root/common/ccd_config.c
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2018-08-07 16:03:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-13 14:25:14 -0700
commita20fff33a9f75e0dbe6ac1f4cb2f987405bf31be (patch)
tree8fe21daf8e128e172cd73f6fd52b5a2d41277456 /common/ccd_config.c
parent25c001a6faf1f2db2fd507e945acb92eac911a1a (diff)
downloadchrome-ec-a20fff33a9f75e0dbe6ac1f4cb2f987405bf31be.tar.gz
cr50: fix in handling VENDOR_RC_IN_PROGRESS when open ccd.
Handling an return value in ccd_command_wrapper has a bug. It doesn't consider return code has VENDOR_RC_ERR value ORed, and compare it directly to VENDOR_RC_IN_PROGRESS. As a result, it treats VENDOR_RC_IN_PROGRESS as an unknown error. BUG=b:112318448 BRANCH=cr50 TEST=manually on cr50 console. (dut) gsctool -a -P Password [Before fix] (cr50) ccd open Password Starting CCD open... [2216.059745 PP start long] Unknown error Usage: ccd [help | ...] > Press the physical button now! [After fix] (cr50) > ccd open Password Starting CCD open... [17.577850 PP start long] > Press the physical button now! ... [Testing for error cases] > ccd lock CCD locked. [3331.669830 CCD state: UARTAP UARTEC] [3331.670883 I2C disconnect] > ccd open Wrong number of params Usage: ccd [help | ...] > ccd open hello Access Denied Usage: ccd [help | ...] > ccd password hello Access Denied Usage: ccd [help | ...] > ccd unlock Wrong number of params Usage: ccd [help | ...] Change-Id: I56123e5fb8048cc8bea1bb7f6be104d4995fd311 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1166257
Diffstat (limited to 'common/ccd_config.c')
-rw-r--r--common/ccd_config.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/ccd_config.c b/common/ccd_config.c
index a3d419356c..2b97ba3133 100644
--- a/common/ccd_config.c
+++ b/common/ccd_config.c
@@ -822,15 +822,15 @@ static int ccd_command_wrapper(int argc, char *password,
vch->ccd_subcommand = subcmd;
memcpy(vch + 1, password, password_size);
- tpm_alt_extension(&vch->tpm_header, sizeof(buf));
+ tpm_alt_extension(&vch->tpm_header, sizeof(buf));
/*
* Return status in the command code field now, in case of error,
* error code is the first byte after the header.
*/
return_code = be32toh(vch->tpm_header.command_code);
- if ((return_code != EC_SUCCESS) &&
- (return_code != VENDOR_RC_IN_PROGRESS)) {
+ if ((return_code != VENDOR_RC_SUCCESS) &&
+ (return_code != (VENDOR_RC_IN_PROGRESS|VENDOR_RC_ERR))) {
return vch->ccd_subcommand;
}
return EC_SUCCESS;