From dbf5e740694e4c44b9f4f01fbe161c7bc1d226ea Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 30 Apr 2019 21:48:14 +0200 Subject: [PATCH] Fix "control reaches end of non-void function" warning --- uart/uart.h | 2 +- uart/uart_posix.c | 3 ++- uart/uart_win32.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/uart/uart.h b/uart/uart.h index 28be233f0..f803655be 100644 --- a/uart/uart.h +++ b/uart/uart.h @@ -107,6 +107,6 @@ uint32_t uart_get_speed(const serial_port sp); /* Reconfigure timeouts */ - bool uart_reconfigure_timeouts(serial_port *sp, uint32_t value ); +int uart_reconfigure_timeouts(serial_port *sp, uint32_t value ); #endif // _UART_H_ diff --git a/uart/uart_posix.c b/uart/uart_posix.c index aeac79b43..87559ff88 100644 --- a/uart/uart_posix.c +++ b/uart/uart_posix.c @@ -73,8 +73,9 @@ struct timeval timeout = { .tv_usec = UART_FPC_CLIENT_RX_TIMEOUT_MS * 1000 }; -bool uart_reconfigure_timeouts(serial_port *sp, uint32_t value ) { +int uart_reconfigure_timeouts(serial_port *sp, uint32_t value ) { timeout.tv_usec = value * 1000; + return PM3_SUCCESS; } serial_port uart_open(const char *pcPortName, uint32_t speed) { diff --git a/uart/uart_win32.c b/uart/uart_win32.c index 6baa5eda4..0096304d0 100644 --- a/uart/uart_win32.c +++ b/uart/uart_win32.c @@ -48,7 +48,7 @@ typedef struct { COMMTIMEOUTS ct; // Serial port time-out configuration } serial_port_windows; -bool uart_reconfigure_timeouts(serial_port *sp, uint32_t value) { +int uart_reconfigure_timeouts(serial_port *sp, uint32_t value) { serial_port_windows *spw = (serial_port_windows*)sp; spw->ct.ReadIntervalTimeout = value; @@ -60,10 +60,11 @@ bool uart_reconfigure_timeouts(serial_port *sp, uint32_t value) { if (!SetCommTimeouts(spw->hPort, &spw->ct)) { uart_close(spw); printf("[!] UART error while setting comm time outs\n"); - return INVALID_SERIAL_PORT; + return PM3_EIO; } PurgeComm(spw->hPort, PURGE_RXABORT | PURGE_RXCLEAR); + return PM3_SUCCESS; } serial_port uart_open(const char *pcPortName, uint32_t speed) {