Browse Source

nrf/boards/microbit/modules: Initialize variable in microbit_sleep.

When compiling for microbit with LTO=0, a compiler error occurs due to
'ms' variable in the microbit_sleep function has not been initialized.

This patch initialize the variable to 0.
pull/3137/merge
Glenn Ruben Bakke 7 years ago
committed by Damien George
parent
commit
62931398d7
  1. 2
      ports/nrf/boards/microbit/modules/modmicrobit.c

2
ports/nrf/boards/microbit/modules/modmicrobit.c

@ -43,7 +43,7 @@ STATIC mp_obj_t microbit_reset_(void) {
MP_DEFINE_CONST_FUN_OBJ_0(microbit_reset_obj, microbit_reset_); MP_DEFINE_CONST_FUN_OBJ_0(microbit_reset_obj, microbit_reset_);
STATIC mp_obj_t microbit_sleep(mp_obj_t ms_in) { STATIC mp_obj_t microbit_sleep(mp_obj_t ms_in) {
mp_int_t ms; mp_int_t ms = 0;
if (mp_obj_is_integer(ms_in)) { if (mp_obj_is_integer(ms_in)) {
ms = mp_obj_get_int(ms_in); ms = mp_obj_get_int(ms_in);
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT

Loading…
Cancel
Save