[PATCH 2/4] drivers/serial: always propagate -EINTR downstream

Philippe Gerum rpm at xenomai.org
Fri Mar 29 18:41:01 CET 2019


No ifs, not buts: drivers must pass -EINTR to the core whenever
received from a blocking call.

NOTE: this change also prevents userland from receiving a partial byte
count from an interrupted read/write operation, although such amount
of bytes may have been transferred from/to the corresponding software
FIFO.

Signed-off-by: Philippe Gerum <rpm at xenomai.org>
---
 kernel/drivers/serial/rt_imx_uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/drivers/serial/rt_imx_uart.c b/kernel/drivers/serial/rt_imx_uart.c
index 32b472c78..9e2ade4cb 100644
--- a/kernel/drivers/serial/rt_imx_uart.c
+++ b/kernel/drivers/serial/rt_imx_uart.c
@@ -1352,7 +1352,7 @@ break_unlocked:
 	clear_bit(0, &ctx->in_lock);
 
 	if ((read > 0) && ((ret == 0) || (ret == -EAGAIN) ||
-			   (ret == -ETIMEDOUT) || (ret == -EINTR)))
+			   (ret == -ETIMEDOUT)))
 		ret = read;
 
 	return ret;
@@ -1471,7 +1471,7 @@ static ssize_t rt_imx_uart_write(struct rtdm_fd *fd, const void *buf,
 	rtdm_mutex_unlock(&ctx->out_lock);
 
 	if ((written > 0) && ((ret == 0) || (ret == -EAGAIN) ||
-			      (ret == -ETIMEDOUT) || (ret == -EINTR)))
+			      (ret == -ETIMEDOUT)))
 		ret = written;
 
 	return ret;
-- 
2.20.1




More information about the Xenomai mailing list