Skip to content

Commit 5f2f97f

Browse files
Fix full condition check
Use kfifo_is_full() to correctly detect when the FIFO is full before dropping the oldest element. Co-authored-by: Po-Ying Chiu <[email protected]>
1 parent 5925766 commit 5f2f97f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

simrupt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static void produce_data(unsigned char val)
6666
* before inserting the new one.
6767
*/
6868
unsigned int len;
69-
if (kfifo_avail(&rx_fifo) < sizeof(val)) {
69+
if (kfifo_is_full(&rx_fifo)) {
7070
unsigned char dummy;
7171
len = kfifo_out(&rx_fifo, &dummy, sizeof(dummy));
7272
if (len != sizeof(dummy))

0 commit comments

Comments
 (0)