]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: serial: ns16550: Correct logic for checking for character
authorSimon Glass <sjg@chromium.org>
Thu, 23 Oct 2014 03:37:03 +0000 (21:37 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 24 Oct 2014 01:29:07 +0000 (19:29 -0600)
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 <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
drivers/serial/ns16550.c

index 63a9ef68444d3af762213467b1b9e9524aaa4473..fe6cc26afe60b86c83f31772345b460c6adecbc5 100644 (file)
@@ -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);