From d81a28097a0cf081ff15aefee8d121b21c121221 Mon Sep 17 00:00:00 2001 From: zhongzhijie1 Date: Mon, 9 Dec 2024 20:49:31 +0800 Subject: [PATCH] btuart_read and returned the correct value. When the nread return value < 0, if the total length ntotal that has been read is > 0, the function returns ntotal; otherwise, it returns the nread error code. Signed-off-by: zhongzhijie1 --- drivers/wireless/bluetooth/bt_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/wireless/bluetooth/bt_uart.c b/drivers/wireless/bluetooth/bt_uart.c index f5ee4105c9d..310c5bdea00 100644 --- a/drivers/wireless/bluetooth/bt_uart.c +++ b/drivers/wireless/bluetooth/bt_uart.c @@ -86,7 +86,7 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper, else if (nread < 0) { wlwarn("Returned error %zd\n", nread); - return nread; + return ntotal > 0 ? ntotal : nread; } wlinfo("read %zd remaining %zu\n", nread, buflen - nread);