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 <zhongzhijie1@xiaomi.com>
This commit is contained in:
zhongzhijie1
2024-12-09 20:49:31 +08:00
committed by Alan C. Assis
parent 386dbfa449
commit d81a28097a

View File

@@ -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);