util/flash_ec: Fix shellcheck warnings
local EC_UART="$(servo_ec_uart)"
^-----^ SC2155: Declare and assign separately to avoid masking
return values.
BRANCH=none
TEST=./util/flash_ec --board=dartmonkey
@@ -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}" )
