[PATCH v2 2/3] ratp: return 0 bytes written from puts if busy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prior behavior was to wrongly report all bytes written if enqueueing wasn't
possible at the time. Instead we should either return 0 or an error code if
users need to retry. write(2) returns 0 in such cases. Follow suit.

As no current users run puts in a loop, this has no effect for now.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
Changes in v2:
	New commit.
---
 common/ratp/ratp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/ratp/ratp.c b/common/ratp/ratp.c
index 9aea1786d684..8ac7dc98b6f8 100644
--- a/common/ratp/ratp.c
+++ b/common/ratp/ratp.c
@@ -267,7 +267,7 @@ static int ratp_console_puts(struct console_device *cdev, const char *s)
 	len = strlen(s);
 
 	if (ratp_busy(&ctx->ratp))
-		return len;
+		return 0;
 
 	kfifo_put(ctx->console_transmit_fifo, s, len);
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux