summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/uart/uart8250io.c3
-rw-r--r--src/drivers/uart/uart8250mem.c4
-rw-r--r--src/soc/broadcom/cygnus/ns16550.c4
3 files changed, 8 insertions, 3 deletions
diff --git a/src/drivers/uart/uart8250io.c b/src/drivers/uart/uart8250io.c
index ac3315a421..4cc7fe3e0b 100644
--- a/src/drivers/uart/uart8250io.c
+++ b/src/drivers/uart/uart8250io.c
@@ -62,7 +62,8 @@ static int uart8250_can_rx_byte(unsigned base_port)
static unsigned char uart8250_rx_byte(unsigned base_port)
{
unsigned long int i = SINGLE_CHAR_TIMEOUT;
- while (i-- && !uart8250_can_rx_byte(base_port));
+ while (i && !uart8250_can_rx_byte(base_port))
+ i--;
if (i)
return inb(base_port + UART8250_RBR);
diff --git a/src/drivers/uart/uart8250mem.c b/src/drivers/uart/uart8250mem.c
index 4e53a92a46..a142cb111a 100644
--- a/src/drivers/uart/uart8250mem.c
+++ b/src/drivers/uart/uart8250mem.c
@@ -82,8 +82,10 @@ static int uart8250_mem_can_rx_byte(void *base)
static unsigned char uart8250_mem_rx_byte(void *base)
{
unsigned long int i = SINGLE_CHAR_TIMEOUT;
- while (i-- && !uart8250_mem_can_rx_byte(base))
+ while (i && !uart8250_mem_can_rx_byte(base)) {
udelay(1);
+ i--;
+ }
if (i)
return uart8250_read(base, UART8250_RBR);
else
diff --git a/src/soc/broadcom/cygnus/ns16550.c b/src/soc/broadcom/cygnus/ns16550.c
index 71a4cb08ef..aa9dd2d818 100644
--- a/src/soc/broadcom/cygnus/ns16550.c
+++ b/src/soc/broadcom/cygnus/ns16550.c
@@ -84,8 +84,10 @@ static int ns16550_tst_byte(void)
static unsigned char ns16550_rx_byte(void)
{
unsigned long int i = SINGLE_CHAR_TIMEOUT;
- while (i-- && !ns16550_tst_byte())
+ while (i && !ns16550_tst_byte()) {
udelay(1);
+ i--;
+ }
if (i)
return read32(&regs->rbr);
else