1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/lpc1768: fix uninitialized variable

This commit is contained in:
Jose Alamos 2018-09-10 09:51:22 +02:00
parent 110a410860
commit 840d8714e2

View File

@ -140,7 +140,7 @@ static int init_base(uart_t uart, uint32_t baudrate)
void uart_write(uart_t uart, const uint8_t *data, size_t len)
{
LPC_UART_TypeDef *dev;
LPC_UART_TypeDef *dev = NULL;
switch (uart) {
#if UART_0_EN
@ -157,9 +157,11 @@ void uart_write(uart_t uart, const uint8_t *data, size_t len)
return;
}
for (size_t i = 0; i < len; i++) {
while (!(dev->LSR & (1 << 5))); /* wait for THRE bit to be set */
dev->THR = data[i];
if (dev) {
for (size_t i = 0; i < len; i++) {
while (!(dev->LSR & (1 << 5))) {} /* wait for THRE bit to be set */
dev->THR = data[i];
}
}
}