diff options
author | Jeremy Bettis <jbettis@google.com> | 2021-08-30 15:40:09 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-31 18:49:14 +0000 |
commit | 1eb508b123bd4b5764ea3956ccf1b49ceb321fcd (patch) | |
tree | 7c9152dc08c8f83885d26d4c3787613cada7c8b0 | |
parent | ed87c0c1ade57ab6e8bd46a11a2f0484a503f1b8 (diff) | |
download | chrome-ec-1eb508b123bd4b5764ea3956ccf1b49ceb321fcd.tar.gz |
zephyr: Removing unused vars
zephyr toolchain doesn't allow unused vars, so this is preventing
running tests on gitlab.
Add -Werror=unused-variable to clang args so that this doesn't
backslide.
BUG=None
TEST=zmake coverage on docker
BRANCH=None
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: I7749041fd0f09e5cf35e6a6c1d4555af805469c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131880
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | zephyr/cmake/compiler/clang/compiler_flags.cmake | 2 | ||||
-rw-r--r-- | zephyr/drivers/cros_cbi/cros_cbi.c | 2 | ||||
-rw-r--r-- | zephyr/emul/emul_bma255.c | 1 | ||||
-rw-r--r-- | zephyr/emul/emul_bmi.c | 2 | ||||
-rw-r--r-- | zephyr/emul/emul_bmi160.c | 3 | ||||
-rw-r--r-- | zephyr/emul/emul_bmi260.c | 4 | ||||
-rw-r--r-- | zephyr/emul/emul_pi3usb9201.c | 3 | ||||
-rw-r--r-- | zephyr/emul/emul_smart_battery.c | 2 | ||||
-rw-r--r-- | zephyr/emul/emul_syv682x.c | 4 | ||||
-rw-r--r-- | zephyr/emul/emul_tcs3400.c | 1 | ||||
-rw-r--r-- | zephyr/test/drivers/src/bma2x2.c | 3 | ||||
-rw-r--r-- | zephyr/test/drivers/src/bmi160.c | 2 | ||||
-rw-r--r-- | zephyr/test/drivers/src/bmi260.c | 2 | ||||
-rw-r--r-- | zephyr/test/drivers/src/tcs3400.c | 5 |
14 files changed, 5 insertions, 31 deletions
diff --git a/zephyr/cmake/compiler/clang/compiler_flags.cmake b/zephyr/cmake/compiler/clang/compiler_flags.cmake index 1f71650975..d247bd622d 100644 --- a/zephyr/cmake/compiler/clang/compiler_flags.cmake +++ b/zephyr/cmake/compiler/clang/compiler_flags.cmake @@ -6,3 +6,5 @@ include("${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake") # Disable -fno-freestanding. set_compiler_property(PROPERTY hosted) + +check_set_compiler_property(APPEND PROPERTY warning_extended -Wunused-variable -Werror=unused-variable) diff --git a/zephyr/drivers/cros_cbi/cros_cbi.c b/zephyr/drivers/cros_cbi/cros_cbi.c index 0aaa5e2b1a..a36a4e9143 100644 --- a/zephyr/drivers/cros_cbi/cros_cbi.c +++ b/zephyr/drivers/cros_cbi/cros_cbi.c @@ -132,7 +132,7 @@ DT_INST_FOREACH_STATUS_OKAY(CBI_SSFC_VALUE_BUILD_ASSERT) static const uint8_t ssfc_values[] = { DT_INST_FOREACH_STATUS_OKAY(CBI_SSFC_VALUE_ARRAY) }; -static union cbi_ssfc cached_ssfc; +static union cbi_ssfc cached_ssfc __attribute__((unused)); /* CBI SSFC part end */ diff --git a/zephyr/emul/emul_bma255.c b/zephyr/emul/emul_bma255.c index f7a18b0697..073e196df8 100644 --- a/zephyr/emul/emul_bma255.c +++ b/zephyr/emul/emul_bma255.c @@ -1047,7 +1047,6 @@ static int bma_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs, { const struct bma_emul_cfg *cfg; struct bma_emul_data *data; - unsigned int len; int ret, i, reg; bool read; diff --git a/zephyr/emul/emul_bmi.c b/zephyr/emul/emul_bmi.c index b5a8de8b5a..d6807d3961 100644 --- a/zephyr/emul/emul_bmi.c +++ b/zephyr/emul/emul_bmi.c @@ -1125,7 +1125,6 @@ static int bmi_emul_handle_read(struct i2c_emul *emul, int reg, int byte, char *buf) { struct bmi_emul_data *data; - uint16_t fifo_len; int ret; data = CONTAINER_OF(emul, struct bmi_emul_data, emul); @@ -1175,7 +1174,6 @@ static int bmi_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs, { const struct bmi_emul_cfg *cfg; struct bmi_emul_data *data; - unsigned int len; int ret, i; bool read; diff --git a/zephyr/emul/emul_bmi160.c b/zephyr/emul/emul_bmi160.c index 8f6572604f..d080574de5 100644 --- a/zephyr/emul/emul_bmi160.c +++ b/zephyr/emul/emul_bmi160.c @@ -404,7 +404,6 @@ static void bmi160_emul_handle_off_comp(uint8_t *regs, struct i2c_emul *emul) static int bmi160_emul_start_cmd(uint8_t *regs, struct i2c_emul *emul, int cmd) { int time; - int ret; switch (cmd) { case BMI160_CMD_SOFT_RESET: @@ -566,7 +565,6 @@ static int bmi160_emul_handle_write(uint8_t *regs, struct i2c_emul *emul, { bool tag_time; bool header; - int ret; if (byte > 1) { LOG_ERR("Block writes are not allowed"); @@ -636,7 +634,6 @@ static int bmi160_emul_handle_read(uint8_t *regs, struct i2c_emul *emul, bool header; int gyr_shift; int acc_shift; - int ret; /* * If register is FIFO data, then read data from FIFO. diff --git a/zephyr/emul/emul_bmi260.c b/zephyr/emul/emul_bmi260.c index 82ca5626ee..69b0e86871 100644 --- a/zephyr/emul/emul_bmi260.c +++ b/zephyr/emul/emul_bmi260.c @@ -281,7 +281,6 @@ static int bmi260_emul_gyr_range_to_shift(uint8_t range) static int bmi260_emul_start_cmd(uint8_t *regs, struct i2c_emul *emul, int cmd) { int time; - int ret; switch (cmd) { case BMI260_CMD_SOFT_RESET: @@ -309,7 +308,6 @@ static int bmi260_emul_start_cmd(uint8_t *regs, struct i2c_emul *emul, int cmd) */ static void bmi260_emul_end_cmd(uint8_t *regs, struct i2c_emul *emul) { - uint8_t pmu_status; bool tag_time; bool header; int cmd; @@ -354,7 +352,6 @@ static int bmi260_emul_handle_write(uint8_t *regs, struct i2c_emul *emul, uint8_t mask; bool tag_time; bool header; - int ret; /* Ignore first byte which sets starting register */ byte -= 1; @@ -440,7 +437,6 @@ static int bmi260_emul_handle_read(uint8_t *regs, struct i2c_emul *emul, bool header; int gyr_shift; int acc_shift; - int ret; /* * If register is FIFO data, then read data from FIFO. diff --git a/zephyr/emul/emul_pi3usb9201.c b/zephyr/emul/emul_pi3usb9201.c index d00ffe24c6..7feedbf7d0 100644 --- a/zephyr/emul/emul_pi3usb9201.c +++ b/zephyr/emul/emul_pi3usb9201.c @@ -96,9 +96,6 @@ static int pi3usb9201_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs, { const struct pi3usb9201_emul_cfg *cfg; struct pi3usb9201_emul_data *data; - unsigned int len; - int ret, i, reg; - bool read; data = CONTAINER_OF(emul, struct pi3usb9201_emul_data, emul); cfg = data->cfg; diff --git a/zephyr/emul/emul_smart_battery.c b/zephyr/emul/emul_smart_battery.c index 23ac01262c..392b9a292b 100644 --- a/zephyr/emul/emul_smart_battery.c +++ b/zephyr/emul/emul_smart_battery.c @@ -294,7 +294,6 @@ static int sbat_emul_read_at_rate_ok(struct sbat_emul_bat_data *bat, { int rem_time_s; int rate; - int cap; rate = bat->at_rate; if (bat->mode & MODE_CAPACITY) { @@ -799,7 +798,6 @@ static int sbat_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs, { const struct sbat_emul_cfg *cfg; struct sbat_emul_data *data; - unsigned int len; int ret = 0, i; data = CONTAINER_OF(emul, struct sbat_emul_data, emul); diff --git a/zephyr/emul/emul_syv682x.c b/zephyr/emul/emul_syv682x.c index 796f162fde..b9c850bcd8 100644 --- a/zephyr/emul/emul_syv682x.c +++ b/zephyr/emul/emul_syv682x.c @@ -82,10 +82,6 @@ static int syv682x_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs, { const struct syv682x_emul_cfg *cfg; struct syv682x_emul_data *data; - unsigned int len; - int ret, i, reg; - bool read; - data = CONTAINER_OF(emul, struct syv682x_emul_data, emul); cfg = data->cfg; diff --git a/zephyr/emul/emul_tcs3400.c b/zephyr/emul/emul_tcs3400.c index ea2e2e7690..874b343a6b 100644 --- a/zephyr/emul/emul_tcs3400.c +++ b/zephyr/emul/emul_tcs3400.c @@ -677,7 +677,6 @@ static int tcs_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs, { const struct tcs_emul_cfg *cfg; struct tcs_emul_data *data; - unsigned int len; int ret, i, reg; bool read; diff --git a/zephyr/test/drivers/src/bma2x2.c b/zephyr/test/drivers/src/bma2x2.c index dffd4ee0be..457aeeef5d 100644 --- a/zephyr/test/drivers/src/bma2x2.c +++ b/zephyr/test/drivers/src/bma2x2.c @@ -607,8 +607,6 @@ static void test_bma_read(void) int16_t ret_acc[3]; int16_t exp_acc[3]; intv3_t ret_acc_v; - uint8_t reg_rate; - int drv_rate; emul = bma_emul_get(BMA_ORD); @@ -728,7 +726,6 @@ static int emul_write_calib_func(struct i2c_emul *emul, int reg, uint8_t val, void *data) { struct calib_func_data *d = data; - int cur_time; if (reg != BMA2x2_OFFSET_CTRL_ADDR) { return 1; diff --git a/zephyr/test/drivers/src/bmi160.c b/zephyr/test/drivers/src/bmi160.c index 2a1494ef9b..d0cfed200d 100644 --- a/zephyr/test/drivers/src/bmi160.c +++ b/zephyr/test/drivers/src/bmi160.c @@ -1547,7 +1547,6 @@ static void test_bmi_init(void) { struct motion_sensor_t *ms_acc, *ms_gyr; struct i2c_emul *emul; - int ret; emul = bmi_emul_get(BMI_ORD); ms_acc = &motion_sensors[BMI_ACC_SENSOR_ID]; @@ -1681,7 +1680,6 @@ static void check_fifo_f(struct motion_sensor_t *ms_acc, /** Test irq handler of accelerometer sensor */ static void test_bmi_acc_fifo(void) { - struct ec_response_motion_sensor_data vector; struct motion_sensor_t *ms, *ms_gyr; struct fifo_func_data func_data; struct bmi_emul_frame f[3]; diff --git a/zephyr/test/drivers/src/bmi260.c b/zephyr/test/drivers/src/bmi260.c index a8aa303765..63b5da0784 100644 --- a/zephyr/test/drivers/src/bmi260.c +++ b/zephyr/test/drivers/src/bmi260.c @@ -1531,7 +1531,6 @@ static void test_bmi_init(void) { struct motion_sensor_t *ms_acc, *ms_gyr; struct i2c_emul *emul; - int ret; emul = bmi_emul_get(BMI_ORD); ms_acc = &motion_sensors[BMI_ACC_SENSOR_ID]; @@ -1673,7 +1672,6 @@ static void check_fifo_f(struct motion_sensor_t *ms_acc, /** Test irq handler of accelerometer sensor */ static void test_bmi_acc_fifo(void) { - struct ec_response_motion_sensor_data vector; struct motion_sensor_t *ms, *ms_gyr; struct fifo_func_data func_data; struct bmi_emul_frame f[3]; diff --git a/zephyr/test/drivers/src/tcs3400.c b/zephyr/test/drivers/src/tcs3400.c index 7f9ce38351..8aaa3c2f38 100644 --- a/zephyr/test/drivers/src/tcs3400.c +++ b/zephyr/test/drivers/src/tcs3400.c @@ -229,7 +229,6 @@ static void test_tcs_read_calibration(void) uint32_t event = TCS_INT_EVENT; int emul_v[4]; int exp_v[4]; - int ret; intv3_t v; emul = tcs_emul_get(TCS_ORD); @@ -359,7 +358,7 @@ static void test_tcs_read_xyz(void) MOTION_SENSE_DEFAULT_SCALE, MOTION_SENSE_DEFAULT_SCALE, MOTION_SENSE_DEFAULT_SCALE, MOTION_SENSE_DEFAULT_SCALE }; - int ret, i, test; + int i, test; intv3_t v; emul = tcs_emul_get(TCS_ORD); @@ -451,7 +450,7 @@ static void test_tcs_scale(void) }; uint16_t scale[3]; int16_t temp; - int ret, i, test; + int i, test; intv3_t v; emul = tcs_emul_get(TCS_ORD); |