serial: xilinx: uartlite: Fix infinite spin in xlnx_uartlite_fifo_read
The xlnx_uartlite_fifo_read function would spin indefinitely if there was less data available in the RX FIFO than the size of the passed-in buffer. This call is supposed to be non-blocking. Fixed to break out of the loop if there are no more bytes left in the RX FIFO. Signed-off-by: Robert Hancock <robert.hancock@calian.com>
This commit is contained in:
parent
c18e7f3ec1
commit
86e1740cfc
|
@ -214,6 +214,9 @@ static int xlnx_uartlite_fifo_read(const struct device *dev, uint8_t *rx_data,
|
|||
rx_data[count++] = xlnx_uartlite_read_rx_fifo(dev);
|
||||
}
|
||||
k_spin_unlock(&data->rx_lock, key);
|
||||
if (!(status & STAT_REG_RX_FIFO_VALID_DATA)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
|
|
Loading…
Reference in a new issue