summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2022-08-25 16:26:19 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-27 00:04:59 +0000
commit9e53c395539c969c52b7a7463148f8ac0ceb5e43 (patch)
treed66b520e76ded961b712aaebd0227927d319b720
parent4778490dd3c1e8281cecc608c748dfa439a50586 (diff)
downloadchrome-ec-9e53c395539c969c52b7a7463148f8ac0ceb5e43.tar.gz
util/flash_ec: Fix shellcheck warnings
local EC_UART="$(servo_ec_uart)" ^-----^ SC2155: Declare and assign separately to avoid masking return values. BRANCH=none BUG=b:242127759 TEST=./util/flash_ec --board=dartmonkey Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I7d12a7758d761575ba638a94e2cc1055f0be5e18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3858401 Reviewed-by: Andrea Grandi <agrandi@google.com>
-rwxr-xr-xutil/flash_ec27
1 files changed, 18 insertions, 9 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 0b595b603b..6d00ed122a 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -1194,8 +1194,10 @@ function flash_stm32() {
# If it is a program-verify request, then make a temporary
# directory to store the image
if [[ "${FLAGS_verify}" == "${FLAGS_TRUE}" ]]; then
- local TEMP_SUFFIX=".$(basename ${SCRIPT}).${CHIP}"
- local TEMP_DIR="$(mktemp -d --suffix="${TEMP_SUFFIX}")"
+ local TEMP_SUFFIX
+ local TEMP_DIR
+ TEMP_SUFFIX=".$(basename "${SCRIPT}").${CHIP}"
+ TEMP_DIR="$(mktemp -d --suffix="${TEMP_SUFFIX}")"
IMG_READ="${TEMP_DIR}/ec.read.bin"
DELETE_LIST+=( "${TEMP_DIR}" )
@@ -1267,7 +1269,8 @@ function dut_i2c_dev() {
return
fi
- local has_i2c_pseudo="$(dut_control_get_or_die \
+ local has_i2c_pseudo
+ has_i2c_pseudo="$(dut_control_get_or_die \
"${ACTIVE_DEVICE}_i2c_pseudo_is_running")"
if [[ "${has_i2c_pseudo}" == False ]]; then
error "i2c-pseudo module is not running on ${ACTIVE_DEVICE}."
@@ -1283,7 +1286,8 @@ function dut_i2c_dev() {
function flash_it83xx() {
local TOOL_PATH="${EC_DIR}/build/${BOARD}/util:$PATH"
- local ITEFLASH_BIN=$(PATH="${TOOL_PATH}" which iteflash)
+ local ITEFLASH_BIN
+ ITEFLASH_BIN=$(PATH="${TOOL_PATH}" which iteflash)
if [[ ! -x "$ITEFLASH_BIN" ]]; then
die "no iteflash util found."
@@ -1331,7 +1335,8 @@ function flash_it83xx() {
info "Asking servo to send the dbgr special waveform to ${CHIP}"
dut_control_or_die enable_ite_dfu
elif servo_is_ccd; then
- local CCD_I2C_CAP="$(dut_control_get ccd_i2c_en)"
+ local CCD_I2C_CAP
+ CCD_I2C_CAP="$(dut_control_get ccd_i2c_en)"
if [[ "${CCD_I2C_CAP,,}" != "always" ]]; then
die "CCD I2C capability is not set as 'Always'" \
": ${CCD_I2C_CAP}"
@@ -1424,9 +1429,11 @@ function flash_npcx_jtag() {
}
function flash_npcx_uut() {
+ local NPCX_UUT
+ local EC_UART
local TOOL_PATH="${EC_DIR}/build/${BOARD}/util:$PATH"
- local NPCX_UUT=$(PATH="${TOOL_PATH}" which uartupdatetool)
- local EC_UART="$(servo_ec_uart)"
+ NPCX_UUT=$(PATH="${TOOL_PATH}" which uartupdatetool)
+ EC_UART="$(servo_ec_uart)"
# Look for npcx_monitor.bin in multiple directories, starting with
# the same path as the EC binary.
@@ -1545,8 +1552,10 @@ function flash_npcx_uut() {
# If it is a program-verify request, then make a temporary
# directory to store the image.
if [[ "${FLAGS_verify}" == "${FLAGS_TRUE}" ]]; then
- local TEMP_SUFFIX=".$(basename ${SCRIPT}).${CHIP}.$$"
- local TEMP_DIR="$(mktemp -d --suffix="${TEMP_SUFFIX}")"
+ local TEMP_SUFFIX
+ local TEMP_DIR
+ TEMP_SUFFIX=".$(basename "${SCRIPT}").${CHIP}.$$"
+ TEMP_DIR="$(mktemp -d --suffix="${TEMP_SUFFIX}")"
IMG_READ="${TEMP_DIR}/ec.read.bin"
DELETE_LIST+=( "${TEMP_DIR}" )