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 <[email protected]>
---
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to