Files
dongjiuzhu1 1946bc4e44 drivers/serial: fix crash when buffer is full and only recvbuf is implemented
When the receive buffer is full and the driver only implements recvbuf
operation without receive operation, the code would crash due to calling
a NULL function pointer. This patch fixes the issue by:

1. Check if recvbuf is available before calling it
2. When buffer is full, use a temporary buffer to drain hardware FIFO
   to prevent data accumulation in hardware
3. Add proper NULL check for receive operation to avoid crash
4. Initialize pbuf to NULL to prevent uninitialized variable usage

This ensures the serial driver works correctly even when only recvbuf
is implemented and the receive buffer is full.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 22:19:21 +08:00
..
2025-06-26 02:30:46 +08:00