From aea2be2012f474ddc9f372547e487ee74d4eb67a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 22 Oct 2014 21:37:03 -0600 Subject: [PATCH] dm: serial: ns16550: Correct logic for checking for character There is a bug in the logic which checks for an available character. This can cause invalid characters to be received - this was noticed on beaglebone. Fix it. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- drivers/serial/ns16550.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 63a9ef6844..fe6cc26afe 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -253,7 +253,7 @@ static int ns16550_serial_getc(struct udevice *dev) { struct NS16550 *const com_port = dev_get_priv(dev); - if (!serial_in(&com_port->lsr) & UART_LSR_DR) + if (!(serial_in(&com_port->lsr) & UART_LSR_DR)) return -EAGAIN; return serial_in(&com_port->rbr); -- 2.39.5