From 2f402db661072d79c71ffdee1bb71cee30d86655 Mon Sep 17 00:00:00 2001 From: liang yongxiang Date: Sat, 21 Jul 2018 12:34:27 +0800 Subject: [PATCH] [device][serial] call rx_indicate function only if the rx_length is not equal 0 --- components/drivers/serial/serial.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index f94b7eda0..856e33e97 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1180,7 +1180,10 @@ void rt_hw_serial_isr(struct rt_serial_device *serial, int event) (serial->config.bufsz - (rx_fifo->get_index - rx_fifo->put_index)); rt_hw_interrupt_enable(level); - serial->parent.rx_indicate(&serial->parent, rx_length); + if (rx_length) + { + serial->parent.rx_indicate(&serial->parent, rx_length); + } } break; } -- GitLab