Commit ddc770a6 authored by Joo Aun Saw's avatar Joo Aun Saw Committed by Johny Mattsson
Browse files

uart: do not use uninitialized uart pins config

parent ca0a2b3f
...@@ -135,7 +135,9 @@ static int uart_setup( lua_State* L ) ...@@ -135,7 +135,9 @@ static int uart_setup( lua_State* L )
unsigned id, databits, parity, stopbits, echo = 1; unsigned id, databits, parity, stopbits, echo = 1;
uint32_t baud, res; uint32_t baud, res;
uart_pins_t pins; uart_pins_t pins;
uart_pins_t* pins_to_use = NULL;
memset(&pins, 0, sizeof(pins));
id = luaL_checkinteger( L, 1 ); id = luaL_checkinteger( L, 1 );
MOD_CHECK_ID( uart, id ); MOD_CHECK_ID( uart, id );
baud = luaL_checkinteger( L, 2 ); baud = luaL_checkinteger( L, 2 );
...@@ -169,9 +171,11 @@ static int uart_setup( lua_State* L ) ...@@ -169,9 +171,11 @@ static int uart_setup( lua_State* L )
lua_getfield (L, 6, "flow_control"); lua_getfield (L, 6, "flow_control");
pins.flow_control = luaL_optint(L, -1, PLATFORM_UART_FLOW_NONE); pins.flow_control = luaL_optint(L, -1, PLATFORM_UART_FLOW_NONE);
pins_to_use = &pins;
} }
res = platform_uart_setup( id, baud, databits, parity, stopbits, &pins ); res = platform_uart_setup( id, baud, databits, parity, stopbits, pins_to_use );
lua_pushinteger( L, res ); lua_pushinteger( L, res );
return 1; return 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment