From 818ae995c2ebba6456469dbc7ff7ba9f174c77c4 Mon Sep 17 00:00:00 2001 From: Tapani Utriainen Date: Thu, 18 May 2017 13:54:17 +0800 Subject: [PATCH] uart.c: fix return value for invalid baudrates in uint2speed This patch probably changes no functionality. Before this patch the return value 0 was used for invalid baudrates in uint2speed, but this is not a proper speed_t constant. Instead the constant B0 is returned now, since on x86 and arm linux architectures B0 is defined as 0. Signed-off-by: Tapani Utriainen Signed-off-by: Brendan Le Foll --- src/uart/uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uart/uart.c b/src/uart/uart.c index e46aff8..9600caa 100644 --- a/src/uart/uart.c +++ b/src/uart/uart.c @@ -110,7 +110,7 @@ uint2speed(unsigned int speed) #endif default: // if we are here, then an unsupported baudrate was selected. - return 0; + return B0; } } @@ -364,7 +364,7 @@ mraa_uart_set_baudrate(mraa_uart_context dev, unsigned int baud) // set our baud rates speed_t speed = uint2speed(baud); - if (speed == 0) + if (speed == B0) { syslog(LOG_ERR, "uart%i: set_baudrate: invalid baudrate: %i", dev->index, baud); return MRAA_ERROR_INVALID_PARAMETER;