Skip to content

Commit

Permalink
stepper: shell: fix uninitialized variable compiler warning
Browse files Browse the repository at this point in the history
Fixes:

/__w/zephyr/zephyr/include/zephyr/drivers/stepper.h:429:16: error:
'direction' may be used uninitialized [-Werror=maybe-uninitialized]

found with:

west build -p -b esp32s3_touch_lcd_1_28/esp32s3/appcpu -T
tests/drivers/stepper/shell/drivers.stepper.shell

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
  • Loading branch information
fabiobaltieri committed Sep 30, 2024
1 parent 8fceb64 commit 5e2203a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/stepper/stepper_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static int cmd_stepper_enable_constant_velocity_mode(const struct shell *sh, siz
{
const struct device *dev;
int err = -EINVAL;
enum stepper_direction direction;
enum stepper_direction direction = STEPPER_DIRECTION_POSITIVE;

for (int i = 0; i < ARRAY_SIZE(stepper_direction_map); i++) {
if (strcmp(argv[ARG_IDX_PARAM], stepper_direction_map[i].name) == 0) {
Expand Down

0 comments on commit 5e2203a

Please sign in to comment.