From 796cd36f85bfaf794df6ceaebbea9b3b4c55ece1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 2 May 2020 19:24:52 +0200 Subject: [PATCH] chg: better error message when serial port allocation fails --- client/src/uart/uart_posix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/uart/uart_posix.c b/client/src/uart/uart_posix.c index 8a624934d..076c02ddf 100644 --- a/client/src/uart/uart_posix.c +++ b/client/src/uart/uart_posix.c @@ -88,7 +88,11 @@ int uart_reconfigure_timeouts(uint32_t value) { serial_port uart_open(const char *pcPortName, uint32_t speed) { serial_port_unix *sp = calloc(sizeof(serial_port_unix), sizeof(uint8_t)); - if (sp == 0) return INVALID_SERIAL_PORT; + + if (sp == 0) { + PrintAndLogEx(ERR, "UART failed to allocate memory"); + return INVALID_SERIAL_PORT; + } // init timeouts timeout.tv_usec = UART_FPC_CLIENT_RX_TIMEOUT_MS * 1000;