Private
Public Access
2
0

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 <tapani@technexion.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Tapani Utriainen
2017-05-18 13:54:17 +08:00
committed by Brendan Le Foll
parent 47c21e0b6c
commit 818ae995c2

View File

@@ -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;