summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2019-05-15 13:50:50 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-17 18:37:46 -0700
commita40f083a67098d4c19a1a46e4fd2a92b4752dd3b (patch)
tree98904427dcd412dc4d95d4f64b667edca4b36f35
parent8a411be5297f9886e6ee8bf1fdac7fe6b7e53667 (diff)
downloadchrome-ec-a40f083a67098d4c19a1a46e4fd2a92b4752dd3b.tar.gz
flash_ec: prevent null entry in dut-control recovery list
With some faulty platforms, dut-control might fail and dut-control recovery list might have a null entry. On flash_ec exit, the command run "dut-control ''" displays a long error message, which confuses users. This CL prevents that happening. BUG=None BRANCH=None TEST=manually ran on hatch, scarlet and coral Change-Id: I26b8c46b5ce6ff529cd368adeb6b24a01ed14566 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1614360 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
-rwxr-xr-xutil/flash_ec10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/flash_ec b/util/flash_ec
index e55db51fd1..7bb5a463f4 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -622,8 +622,12 @@ declare -a save
# $2: (optional) Value to restore for the name at exit.
#######################################
function servo_save_add() {
+ local CTRL_RESULT=
case $# in
- 1) save+=( "$( "${DUT_CONTROL_CMD[@]}" "$@" )" )
+ 1) CTRL_RESULT="$( "${DUT_CONTROL_CMD[@]}" "$@" )"
+ if [[ -n "${CTRL_RESULT}" ]]; then
+ save+=( "${CTRL_RESULT}" )
+ fi
;;
2) save+=( "$1:$2" )
;;
@@ -650,7 +654,9 @@ function servo_save() {
function servo_restore() {
info "Restoring servo settings..."
for ctrl in "${save[@]}"; do
- dut_control "$ctrl"
+ if [[ -n "${ctrl}" ]]; then
+ dut_control "${ctrl}"
+ fi
done
}