mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 17:18:24 +00:00
Revert "serial: set the errno if and only if in thread context"
This reverts commit 07bd09fc0f.
The validation of the context is done with in `rt_set_errno`. So it's
safe to call it here.
This commit is contained in:
@@ -257,8 +257,8 @@ static rt_size_t rt_serial_read(struct rt_device *dev,
|
||||
}
|
||||
|
||||
read_nbytes = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
|
||||
/* set error code if and only if in thread context */
|
||||
if (read_nbytes == 0 && !rt_interrupt_get_nest())
|
||||
/* set error code */
|
||||
if (read_nbytes == 0)
|
||||
{
|
||||
rt_set_errno(-RT_EEMPTY);
|
||||
}
|
||||
@@ -349,8 +349,7 @@ static rt_size_t rt_serial_write(struct rt_device *dev,
|
||||
}
|
||||
|
||||
write_nbytes = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
|
||||
/* set error code if and only if in thread context */
|
||||
if (write_nbytes == 0 && !rt_interrupt_get_nest())
|
||||
if (write_nbytes == 0)
|
||||
{
|
||||
rt_set_errno(-RT_EFULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user