From 62931398d76063f25e0c51de60a4fb42a0f9aa03 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Mon, 26 Feb 2018 19:03:49 +0100 Subject: [PATCH] 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. --- ports/nrf/boards/microbit/modules/modmicrobit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/microbit/modules/modmicrobit.c b/ports/nrf/boards/microbit/modules/modmicrobit.c index 3ab688c5b6..8fa1fd8f2e 100644 --- a/ports/nrf/boards/microbit/modules/modmicrobit.c +++ b/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_); 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)) { ms = mp_obj_get_int(ms_in); #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT